lua-users home
lua-l archive

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


> Though you then need to get slightly more creative about encoding the
> type. A double has 52 bits of mantissa; with 48 taken for a
> pointer-sized value, and 1 taken to ensure a quiet NaN, you only have
> 3 bits left to encode the type. If you borrow the sign bit as well,
> then you have 4 bits. For reference, the current implementation in 5.2
> beta uses 6 bits for encoding type.

Dont you need just 1 bit to encode if its a pointer or something else.
Or 2 bits for the various different pointer types Lua has (light user
data vs "heavy" user data, etc.).

All other types who only need a 32bit data load have enough bits left
to get encoded what that load is.