Re: Binary file byte ordering



On 23 Jan, 09:12, "alangll...@xxxxxxx" <alangll...@xxxxxxx> wrote:
Ignoring endian issues (ie assuming that you have reversed the 10
bytes on an Intel PC) you could bit-twiddle in your own language like
this (Bit0 == LSB) ...

Note value of Bit10(ext)
Discard Bit0 - Bit 10(ext)
Copy Bit11 - Bit62(ext) to Bit0 - Bit51(double)
Discard Bit63 - Bit67 (ext)
Copy Bit68 - Bit79(ext) to Bit52 - Bit63(double)
If Bit10(ext) = 1 then set Bit0(double) to 1

As a help and example, here is a debug of the bytes in a file for a
value, first as an extended, and then as a double, followed by a DWord
of $FFFFFFFF (or 0xFFFFFFFF if that's your fancy). Don't forget the
endian effect so that $40 is the MSByte of both the extended and the
double.

hex
byte
index
0000 81 04 C5 8F 31 B7 E6 C0-0C 40 A1 F8 31 E6 D6 1C
0010 C8 40 FF FF FF FF

Alan Lloyd
.