lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Ralph Hempel wrote:
Andrew Gorges wrote:

print(, 0xFFFFFFFF))
-- displays 0

What does 3, 1 ) result in?

Are we seeing the result of truncation and endianness issues
of what we assume is a 32 bit value that is actually a 64
bit value when compiled?

Just got a copy of Lfw The problem is probably in TOBIT() in lbitlib.c. It looks rather complex, I haven't tried picking it apart yet...

Using bit.cast to test TOBIT() by itself:

> print(bit.cast(0x7fffffff))
> print(bit.cast(0xffffffff))

Which is supposed to be -1 with 32-bit ints. 0xffffffff is correctly represented in Lua, since:

> print(0xFFFFFFFF)

So, something wrong is happening when TOBIT() tries to convert the double to an integer.

BTW, I think the LfW page should also point to the Google project for regular downloads, since it is much faster.

Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia