[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug in Lua when using signed long
- From: Mark Hamburg <mark@...>
- Date: Sun, 13 Dec 2009 18:34:15 -0800
On Dec 13, 2009, at 11:14 AM, Mike Pall wrote:
> Mark Hamburg wrote:
>>> But it would make sense to use an out-of-the-box configuration
>>> where lua_Integer is a subset of lua_Number. One could just use
>>> LUAI_INT32.
>>>
>>> Alas, it's a bit too late to fix that now. Changing lua_Integer
>>> would break the Lua 5.1 ABI.
>>
>> My primary use case for integers exceeding the range of ints are
>> file offsets. These will pretty much always fit in the precision
>> afforded by double but often not in the precision afforded by
>> int.
>
> But 64 bit file offsets are not specific to 64 bit platforms. In
> other words: using lua_Integer means your code would certainly
> break on a 32 bit platform.
>
> That's why e.g. the LJ2 code for fp:seek() (in lib_io.c) uses the
> equivalent of lua_tonumber() and lua_pushnumber() for that purpose.
Good point. What I really want is: push really big integer (and its inverse) -- e.g., offset_t.
Mark
- References:
- Bug in Lua when using signed long, liam mail
- Re: Bug in Lua when using signed long, GrayFace
- Re: Bug in Lua when using signed long, Florian Weimer
- Re: Bug in Lua when using signed long, liam mail
- Re: Bug in Lua when using signed long, Luiz Henrique de Figueiredo
- Re: Bug in Lua when using signed long, liam mail
- Re: Bug in Lua when using signed long, Mark Hamburg
- Re: Bug in Lua when using signed long, Mike Pall
- Re: Bug in Lua when using signed long, Mark Hamburg
- Re: Bug in Lua when using signed long, Mike Pall