lua-users home
lua-l archive

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


We often test Lua on 16-bit machines, and it runs without problems.
Of course there can be problems on some platforms, but that is also
true for 32-bit machines. Particularly, nowhere in the code we assume
that "int" is a 32-bit value, or that a pointer fits in any particular
integer type. We always use longs when we need 32 bits.


> I have noticed that there is a define which determines the number of
> bits in an integer and so for, this appears to be used for the virtual
> machine stuff.

This macro is used in some places where we assume that an int *may* be
larger than 16 bits:

  #if BITS_INT > 26
  #define MAXBITS         24
  #else
  #define MAXBITS         (BITS_INT-2)
  #endif

and

  #if SIZE_Bx < BITS_INT-1
  #define MAXARG_Bx        ((1<<SIZE_Bx)-1)
  #define MAXARG_sBx        (MAXARG_Bx>>1)         /* `sBx' is signed */
  #else
  #define MAXARG_Bx        MAX_INT
  #define MAXARG_sBx        MAX_INT
  #endif


So, it avoids the assumption that our int has more than 26 (or 18) bits.

-- Roberto