fix syntax

This commit is contained in:
2026-02-17 09:15:15 -06:00
parent f310c18b84
commit 4e1b63fd0e
52 changed files with 2169 additions and 1754 deletions

8
math.c
View File

@@ -10,7 +10,7 @@
// Utility function to get number from array index
static double js_getnum_uint32(JSContext *js, JSValue v, unsigned int i)
{
JSValue val = JS_GetPropertyUint32(js,v,i);
JSValue val = JS_GetPropertyNumber(js,v,i);
double ret = js2number(js, val);
JS_FreeValue(js,val);
return ret;
@@ -30,7 +30,7 @@ static float *js2floats(JSContext *js, JSValue v, size_t *len)
static JSValue floats2array(JSContext *js, float *vals, size_t len) {
JSValue arr = JS_NewArray(js);
for (size_t i = 0; i < len; i++) {
JS_SetPropertyUint32(js, arr, i, number2js(js, vals[i]));
JS_SetPropertyNumber(js, arr, i, number2js(js, vals[i]));
}
return arr;
}
@@ -94,7 +94,7 @@ JSC_CCALL(math_norm,
JSValue newarr = JS_NewArray(js);
for (int i = 0; i < len; i++)
JS_SetPropertyUint32(js, newarr, i, number2js(js,js_getnum_uint32(js, argv[0],i)/length));
JS_SetPropertyNumber(js, newarr, i, number2js(js,js_getnum_uint32(js, argv[0],i)/length));
ret = newarr;
)
@@ -238,7 +238,7 @@ JSC_CCALL(math_from_to,
int i = 0;
for (double val = start; val <= end; val += step) {
if (val == end && !inclusive) break;
JS_SetPropertyUint32(js, jsarr, i++, number2js(js, val));
JS_SetPropertyNumber(js, jsarr, i++, number2js(js, val));
}
return jsarr;