From e245d3a18957e43ef902a59a72c8902e2e4435b9 Mon Sep 17 00:00:00 2001 From: Philipp Janda Date: Sat, 10 Oct 2020 16:43:46 +0200 Subject: Fix bit32 conversion issues for Lua 5.1 on 32 bit 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. --- tests/test-bit32.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') 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") assert(bit32.bnot(0) == 2^32-1) +assert(bit32.bnot(-1) == 0) assert(bit32.band(1, 3, 5) == 1) assert(bit32.bor(1, 3, 5) == 7) -- cgit v1.2.3-55-g6feb