lua-users home
lua-l archive

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


Good Point --> "BTW, I think the LfW page should also point to the
Google project for regular downloads, since it is much faster."   Will
do. AGRW


On Fri, Dec 12, 2008 at 1:51 AM, KHMan <keinhong@gmail.com> wrote:
> Ralph Hempel wrote:
>>
>> Andrew Gorges wrote:
>>
>>> print(bit.band(3, 0xFFFFFFFF))
>>> -- displays 0
>>
>> What does bit.band( 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 5.1.4.20. 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))
> 2147483647
>> print(bit.cast(0xffffffff))
> -2147483648
>
> Which is supposed to be -1 with 32-bit ints. 0xffffffff is correctly
> represented in Lua, since:
>
>> print(0xFFFFFFFF)
> 4294967295
>
> 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.
>
> --
> Cheers,
> Kein-Hong Man (esq.)
> Kuala Lumpur, Malaysia
>