lua-users home
lua-l archive

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


On Tue, 12 Aug 2008, Tim Maxwell wrote:
>
> How can I detect if the running machine has middle-endian floats?

Store a floating point number and analyse the byte string.
For example, the laout of 1.0 can be:

byte   LE   BE   ARM FPA
   0 : 00 : 3F : 00
   1 : 00 : F0 : 00
   2 : 00 : 00 : F0
   3 : 00 : 00 : 3F
   4 : 00 : 00 : 00
   5 : 00 : 00 : 00
   6 : F0 : 00 : 00
   7 : 3F : 00 : 00


> Which of the following byte orders do you mean?
> A: 5 6 7 8   1 2 3 4

This one.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
LUNDY FASTNET: WESTERLY 5 TO 7, OCCASIONALLY GALE 8 AT FIRST, DECREASING 4 OR
5. ROUGH OR VERY ROUGH, BECOMING MODERATE OR ROUGH. SQUALLY SHOWERS. GOOD.