Don't test bitwise operations on operands that don't fit in u32.

The current behavior is undefined in C when converting the double to a
u32, so the tests fail on some compilers. For now, I'm just removing
those parts of the tests because I'm not sure what I want the behavior
to be. Modulo? Truncate? Runtime error?
This commit is contained in:
Bob Nystrom
2017-01-12 21:32:50 -08:00
parent 252265c80b
commit e8dfb1bf10
8 changed files with 32 additions and 44 deletions
+1 -3
View File
@@ -618,9 +618,7 @@ DEF_PRIMITIVE(num_bangeq)
DEF_PRIMITIVE(num_bitwiseNot)
{
// Bitwise operators always work on 32-bit unsigned ints.
uint64_t wideVal = AS_NUM(args[0]);
uint32_t val = wideVal & 0xFFFFFFFF;
RETURN_NUM(~(uint32_t)val);
RETURN_NUM(~(uint32_t)AS_NUM(args[0]));
}
DEF_PRIMITIVE(num_dotDot)