Consider adding isBitwiseSafeInteger OR is.i32 & is.u32 ?
kirilloid opened this issue · 1 comments
kirilloid commented
There are operations (mostly bit-wise), which convert number to signed (and sometimes unsigned) 32-bit integer.
Math.imul(1e15, 1e16) === -2147483648
1 << 31 === -2147483648
1e11 & -1 === 1215752192
1e10 ^ 3e10 === -1473755136
but there is also unsigned right shift, which converts to 32-bit unsigned int: -1 >>> 0 === 4294967295
.
This is not needed very often, but might be useful.
mov-78 commented
Hi @kirilloid, I think we'd better put these methods in a separate bundle, because IMHO they're not very general.