[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Lua 5.2 Truncation error in lua_tointeger
- From: liam mail <liam.list@...>
- Date: Sun, 8 Apr 2012 16:35:45 +0100
When using the ieee754 trick on an x86_64 machine where
sizeof(lua_Integer) ==8 and sizeof(int) == 4, the following fails in
5.2 yet passes in 5.1
CPPUNIT_ASSERT(sizeof(lua_Integer) == 8);
CPPUNIT_ASSERT(sizeof(int) == 4);
lua_Integer input = 0x1ffffffff;
lua_pushinteger(l, input );
CPPUNIT_ASSERT_EQUAL(input,lua_tointeger(l,1));
This is due to lua_number2integer when LUA_IEEE754TRICK is defined and
called by lua_tointegerx
#define lua_number2integer(i,n) lua_number2int32(i, n, lua_Integer)
Liam