File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -40943,16 +40943,16 @@ static double js_math_fround(double a)
40943
40943
static JSValue js_math_imul(JSContext *ctx, JSValue this_val,
40944
40944
int argc, JSValue *argv)
40945
40945
{
40946
- int a, b;
40946
+ uint32_t a, b, c;
40947
+ int32_t d;
40947
40948
40948
- if (JS_ToInt32 (ctx, &a, argv[0]))
40949
+ if (JS_ToUint32 (ctx, &a, argv[0]))
40949
40950
return JS_EXCEPTION;
40950
- if (JS_ToInt32 (ctx, &b, argv[1]))
40951
+ if (JS_ToUint32 (ctx, &b, argv[1]))
40951
40952
return JS_EXCEPTION;
40952
- /* TODO(bnoordhuis) Signed integral narrowing has implementation-defined
40953
- * behavior but that's a step up from the undefined behavior it replaced.
40954
- */
40955
- return js_int32((int64_t)a * (int64_t)b);
40953
+ c = a * b;
40954
+ memcpy(&d, &c, sizeof(d));
40955
+ return js_int32(d);
40956
40956
}
40957
40957
40958
40958
static JSValue js_math_clz32(JSContext *ctx, JSValue this_val,
You can’t perform that action at this time.
0 commit comments