lua-users home
lua-l archive

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


On Thu, Jul 11, 2013 at 10:52 AM, Francisco Olarte
<folarte@peoplecall.com> wrote:
> Hi:
>
> I've lost the track of the original poster....
>
> On Wed, Jul 10, 2013, at 01:07 PM, Jay Carlson wrote:
>>
>> > On Jul 10, 2013 12:47 PM, "Todd Coram"
>> > <todd@maplefish.com[mailto:todd@maplefish.com]> wrote:
>> ...
>>
>> Not to be pedantic, but when protocol specifies 64 bit ints, it is
>> expected to handle 64 bit ints. If someone decides to pack extra
>> meta-information into the upper bits of a 64 bit numbers, my Lua code
>> shouldn't munge it.
>>
>>
>> A few months ago I released a BSON parser in pure Lua and was questioned
>> by the BSON folk whether I truly supported int64 ... well I don't :-(
>>
> Being pedantic, if your lua code munges it, it's bad code. I remember
> handling 32 and 48 bit ints without problems in 8086 assembler, you just
> have to code it right. This means do not code assuming you have 64 bits ints
> if not guaranteed. If 32 is a given, use hi and lo words. If 53 is
> guaranteed and useful for normal purposes, split in 13+53, or 16+48, so
> normal case is fast. Or use 8 byte strings. If you NEED 64 bits integer, use
> a language which guarantees them.
>
> Francisco Olarte.

Or use a bignum library.

/s/ Adam