-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Closed
Copy link
Labels
arch-wasmWebAssembly architectureWebAssembly architecturearea-System.Runtime.InteropServices.JavaScript
Milestone
Description
Description
JavaScript Number is float64 type. Integers outside of Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER can't be represented.
Out current code from emscripten is
getValue
case 'i64': return HEAP32[((ptr)>>2)];
And setValue
case 'i64': (tempI64 = [value>>>0,(tempDouble=value,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? ((Math.min((+(Math.floor((tempDouble)/4294967296.0))), 4294967295.0))|0)>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)],HEAP32[((ptr)>>2)] = tempI64[0],HEAP32[(((ptr)+(4))>>2)] = tempI64[1]); break;
Reproduction Steps
Net 7.0 preview 4 and below on WASM.
Expected behavior
Use available 52 bits both directions and throw on overflow.
Give user option to marshal also as BigInt
Actual behavior
Value is trimmed to 32bits only.
Regression?
No
Known Workarounds
use double on C# side too.
Metadata
Metadata
Assignees
Labels
arch-wasmWebAssembly architectureWebAssembly architecturearea-System.Runtime.InteropServices.JavaScript