lua-users home
lua-l archive

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


Peter Shook wrote:
>If you run luac on a 32-bit platform, it's output is guaranteed to run 
>on any other 32-bit platform.  Lua can handle the endian switch.

As long as the endianness difference is little x big, which should cover
most if not all the current platforms. As I recall, some platforms (vax?)
were (are?) "middle-endian" or something weird like that.

Also, if lua_Number is float or double, the internal representation must match,
up to endianness as above. In these days of IEEE FPUs, this is not a problem,
but it may be a problem if you try to run on an old Cray code compiled in an
Intel box. luac does test the integrity of lua_Numbers.

These assumptions are made so that lundump.c is small and fast. Loading binary
chunks that have the same endianness is really fast. If the endianness is 
different, than it's a little bit slower. BTW, you can use luac to "correct"
endianness. Just "compile" your binary chunk again.
--lhf