lua-users home
lua-l archive

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


???There are no 63bit integers??? (or do you know a 63 bit processor?)

... it is only that 64bit integers have 1 sign bit and 63 "number
bits" - but this is in any 64bit system like this ... Lua does not
handle this anyhow differently than C.

Just in C you have the option to use "unsinged int" ...  for such
"BIT-Only" values like UUIDs many people might prefer to do this ...
Lua does ALWAYS uses "signed int" for its math operations...  As long
as you do not use Lua math on such ints you will not notice any
problems.

But if somebody uses Lua math on such "64bit Bit integers" with MSB
set (MSB is Bit Nr. 63... this is because bit counting starts with Bit
0), then this user will run in problems, but there are clear warnings
in the Lua reference manual / Programming in Lua about this ... .

(explaining the differences and pecularities of signed / unsigned to C
beginners is really hard ... this would clearly in no way be
recommendable to Lua users, so I think this Lua solution used
currently is very smart and useful).


On Sun, Aug 29, 2021 at 5:54 PM Soni "They/Them" L. <fakedme@gmail.com> wrote:
>
> A lot of code written for Lua 5.3+ assumes integers are 64-bit,
> including stuff that involves UUIDs. However, would it still be in spec
> to have 63-bit integers, or even "big integers" (if capped to some
> length to satisfy math.maxinteger/math.mininteger)?