lua-users home
lua-l archive

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


> The test for endianness seems brittle to me: it assumes that a short is
> two bytes long, which is common, but not guaranteed by C standard,
> as the following assertion also aknowledge (IIUC).
> 
> In particular, if a short is 1 byte pack("h",1) will return "\1" on both
> big endian and little endian machines.
> 
> Is that a bug in the test suite or just a conscious tradeoff to avoid
> more complex testing on exotic platforms?

There is no need for a more complex testing. It could (should) be

  local little = (pack("i2", 1) == "\1\0")

Thanks for the report.

-- Roberto