diff options
author | Jukka Jylanki <jjylanki@imvu.com> | 2013-03-27 08:58:35 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-12 14:26:50 +0300 |
commit | 0c11a28ccfa3716962c7424fe227c82edc04de16 (patch) | |
tree | 4dcf8973afb7b193f32211fd38b0659e272cb15b /src | |
parent | 113721e6c6ca4cbde2bb39c4460269424ef3d81d (diff) |
Fix passing of UINT_MAX and ULONG_MAX from C++ to JS function. LLVM doesn't have u32 type, so UINT_MAX literal comes out as 'i32 -1' literal to JS, which whould treat it as a negative -1.0 double.
Diffstat (limited to 'src')
-rwxr-xr-x | src/embind/embind.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index ccce9f19..1a2cec44 100755 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -225,7 +225,10 @@ function __embind_register_bool(rawType, name, trueValue, falseValue) { // [minRange, maxRange], inclusive. function __embind_register_integer(primitiveType, name, minRange, maxRange) { name = Pointer_stringify(name); - registerType(rawType, { + if (maxRange == -1) { // LLVM doesn't have signed and unsigned 32-bit types, so u32 literals come out as 'i32 -1'. Always treat those as max u32. + maxRange = 4294967295; + } + registerType(primitiveType, { name: name, minRange: minRange, maxRange: maxRange, |