aboutsummaryrefslogtreecommitdiff
path: root/tests/test-bit32.lua
diff options
context:
space:
mode:
authorPhilipp Janda <siffiejoe@gmx.net>2020-10-10 16:43:46 +0200
committerPhilipp Janda <siffiejoe@gmx.net>2020-10-10 16:43:46 +0200
commite245d3a18957e43ef902a59a72c8902e2e4435b9 (patch)
treeabfa4c390f13023f5959e29d6ec1b48b368fb1cf /tests/test-bit32.lua
parent8186510a981fcc72685716f15f100838fa7d0b4b (diff)
downloadlua-compat-5.3-e245d3a18957e43ef902a59a72c8902e2e4435b9.tar.gz
lua-compat-5.3-e245d3a18957e43ef902a59a72c8902e2e4435b9.tar.bz2
lua-compat-5.3-e245d3a18957e43ef902a59a72c8902e2e4435b9.zip
Fix bit32 conversion issues for Lua 5.1 on 32 bitv0.10
The default unsigned conversion procedure from upstream using `lua_Integer` as an intermediate value fails if `lua_Integer` has only 32 bits (as is the case on 32 bit Lua 5.1). This fix uses a `lua_Number` (hopefully double) as intermediate value in those cases.
Diffstat (limited to 'tests/test-bit32.lua')
-rwxr-xr-xtests/test-bit32.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/test-bit32.lua b/tests/test-bit32.lua
index cc91e52..a408b7d 100755
--- a/tests/test-bit32.lua
+++ b/tests/test-bit32.lua
@@ -4,6 +4,7 @@ local bit32 = require("bit32")
4 4
5 5
6assert(bit32.bnot(0) == 2^32-1) 6assert(bit32.bnot(0) == 2^32-1)
7assert(bit32.bnot(-1) == 0)
7assert(bit32.band(1, 3, 5) == 1) 8assert(bit32.band(1, 3, 5) == 1)
8assert(bit32.bor(1, 3, 5) == 7) 9assert(bit32.bor(1, 3, 5) == 7)
9 10