fix syntax
This commit is contained in:
8
math.c
8
math.c
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user