Verified Commit 8fd39cfb authored by Camil Staps's avatar Camil Staps 🙂

Add support for BigInt to _copy_js_to_clean

parent 2e451344
......@@ -256,6 +256,21 @@ class ABCInterpreter {
}
hp+=16;
hp_free-=2;
} else if (typeof values[i]=='bigint'){
this.memory_array[hp/4]=this.addresses.JSInt;
this.memory_array[hp/4+1]=0;
if (values[i]>2**31 || values[i]<0-2**31) {
if (typeof BigInt64Array!='undefined') {
const bigint_array=new BigInt64Array(this.memory_array.buffer, hp+8);
bigint_array[0]=values[i];
} else {
this.memory_array[hp/4+2]=Number (values[i] & BigInt (0xffffffff));
this.memory_array[hp/4+3]=Number (values[i] >> BigInt (32));
}
} else {
this.memory_array[hp/4+2]=Number (values[i]);
this.memory_array[hp/4+3]=0;
}
} else if (typeof values[i]=='boolean') {
this.memory_array[store_ptrs/4]=hp;
this.memory_array[hp/4]=this.addresses.JSBool;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment