mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- Add exact 64-bit and pointer ABIs, static node:ffi bindings, and Darwin framework linking. - Support native memory views and reusable callback pools with checked conversions and lifetime handling. - Preserve the JavaScript values, accessors, and module bindings used during renderer initialization.
14 lines
880 B
JavaScript
14 lines
880 B
JavaScript
globalThis.nativeU64 = value => BigInt.asUintN(64, value);
|
|
globalThis.nativeI64 = value => BigInt.asIntN(64, value);
|
|
globalThis.nativePointer = value => value;
|
|
globalThis.pointerNew = () => 12345n;
|
|
globalThis.pointerCheck = value => value === 12345n;
|
|
globalThis.callbackU64 = (callback, value) => BigInt.asUintN(64, callback(BigInt.asUintN(64, value)));
|
|
globalThis.callbackI64 = (callback, value) => BigInt.asIntN(64, callback(BigInt.asIntN(64, value)));
|
|
globalThis.callbackPointer = (callback, value) => callback(value);
|
|
globalThis.wideMix = (a,b,c,d,e,f,g,h,i,j,k,l,m,n) => a+c+e+g+i+k+m+BigInt(Math.trunc(b+Math.fround(d)+f+Math.fround(h)+j+Math.fround(l)+n));
|
|
let saved;
|
|
globalThis.wideStart = callback => { saved = callback; };
|
|
globalThis.wideFire = value => BigInt.asUintN(64, saved(value));
|
|
globalThis.wideStop = callback => { if (saved === callback) saved = undefined; };
|