Skip to content

Commit

Permalink
stop trying to be smarter than you are
Browse files Browse the repository at this point in the history
  • Loading branch information
richarddd authored Dec 22, 2024
1 parent 5364adc commit 50277e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -54768,9 +54768,10 @@ JSValue JS_NewUint8ArrayCopy(JSContext *ctx, const uint8_t *buf, size_t len)
int JS_GetTypedArrayType(JSValue obj)
{
JSClassID class_id = JS_GetClassID(obj);
int mask = -((class_id >= JS_CLASS_UINT8C_ARRAY) & (class_id <= JS_CLASS_FLOAT64_ARRAY));
int offset = (class_id - JS_CLASS_UINT8C_ARRAY) & mask;
return offset | (~mask & -1);
if (class_id >= JS_CLASS_UINT8C_ARRAY && class_id <= JS_CLASS_FLOAT64_ARRAY)
return class_id - JS_CLASS_UINT8C_ARRAY;
else
return -1;
}

/* Atomics */
Expand Down

0 comments on commit 50277e3

Please sign in to comment.