byte 1 byte 2 byte 3
1000100010010001 0110110010111100 0010001010110010
8 8 9 1 6 c b c 2 2 b 2
------------------------------------------------------
byte 1
1000100010010001
8 8 9 1
AND $00ff
xxxxxxxx10010001<-------------------
xxxxxxxx10010001 (upper_field << 20 00001001000100000000000000000000
x x 9 1 0 9 1 0 0 0 0 0
AND $ff00
10001000xxxxxxxx<----
10001000xxxxxxxx (lower_field << 5) 00000000000100010000000000000000
8 8 x x 0 0 1 1 0 0 0 0
=======================================================================
byte 2
0110110010111100
6 c b c
AND $ff00
---------->01101100xxxxxxxx
01101100xxxxxxxx (upper_field >> 11) 00001001000100000000000000001101
6 c x x 0 9 1 0 0 0 0 d
AND $ffff
0110110010111100<--------------------
0110110010111100 (lower_field << 21) 10010111100100010000000000000000
6 c b c 9 7 9 1 0 0 0 0
=======================================================================
byte 3
0010001010110010
2 2 b 2
AND $8000
0xxxxxxxxxxxxxxx<---------------
0xxxxxxxxxxxxxxx (upper_field << 16) 00001001000100000000000000001101
0 0 0 0 0 9 1 0 0 0 0 d
AND $7fff
x010001010110010<----
x010001010110010 (upper_field << 5) 00001001000101000101011001001101
0 2 b 2 0 9 1 4 5 6 4 d
=======================================================================
00001001000101000101011001001101 (upper_field)
10010111100100010000000000000000 (lower_field)
10011111100101010101011001001101
9 f 9 5 5 6 4 d ($9f95564d != 0)
=======================================================================
0 3 7 e
0000001101111110<-------------------
($037e << 20) 00110111111000000000000000000000
3 7 e 0 0 0 0 0
ADD
(upper_field) 00001001000101000101011001001101
0 9 1 4 5 6 4 d
EQU
01000000111101000101011001001101
(upper_field) 4 0 f 4 5 6 4 d
=======================================================================
upper_field lower_field
01000000111101000101011001001101 10010111100100010000000000000000
4 0 f 4 5 6 4 d 9 7 9 1 0 0 0 0
$40f4564d97910000 = 83300.849503517150
What does one take a day to do? They take a day to flowchart the conversion of some unknown, 48bit, funky floating point (ffp) format into IEEE-754 format by reverse engineering a 15 year old C program.
Comments
byte 1 byte 2 byte 3 1000100010010001 0110110010111100 0010001010110010 8 8 9 1 6 c b c 2 2 b 2 ------------------------------------------------------ byte 1 1000100010010001 8 8 9 1 AND $00ff xxxxxxxx10010001<------------------- xxxxxxxx10010001 (upper_field << 20 00001001000100000000000000000000 x x 9 1 0 9 1 0 0 0 0 0 AND $ff00 10001000xxxxxxxx<---- 10001000xxxxxxxx (lower_field << 5) 00000000000100010000000000000000 8 8 x x 0 0 1 1 0 0 0 0 ======================================================================= byte 2 0110110010111100 6 c b c AND $ff00 ---------->01101100xxxxxxxx 01101100xxxxxxxx (upper_field >> 11) 00001001000100000000000000001101 6 c x x 0 9 1 0 0 0 0 d AND $ffff 0110110010111100<-------------------- 0110110010111100 (lower_field << 21) 10010111100100010000000000000000 6 c b c 9 7 9 1 0 0 0 0 ======================================================================= byte 3 0010001010110010 2 2 b 2 AND $8000 0xxxxxxxxxxxxxxx<--------------- 0xxxxxxxxxxxxxxx (upper_field << 16) 00001001000100000000000000001101 0 0 0 0 0 9 1 0 0 0 0 d AND $7fff x010001010110010<---- x010001010110010 (upper_field << 5) 00001001000101000101011001001101 0 2 b 2 0 9 1 4 5 6 4 d ======================================================================= 00001001000101000101011001001101 (upper_field) 10010111100100010000000000000000 (lower_field) 10011111100101010101011001001101 9 f 9 5 5 6 4 d ($9f95564d != 0) ======================================================================= 0 3 7 e 0000001101111110<------------------- ($037e << 20) 00110111111000000000000000000000 3 7 e 0 0 0 0 0 ADD (upper_field) 00001001000101000101011001001101 0 9 1 4 5 6 4 d EQU 01000000111101000101011001001101 (upper_field) 4 0 f 4 5 6 4 d ======================================================================= upper_field lower_field 01000000111101000101011001001101 10010111100100010000000000000000 4 0 f 4 5 6 4 d 9 7 9 1 0 0 0 0 $40f4564d97910000 = 83300.849503517150What does one take a day to do? They take a day to flowchart the conversion of some unknown, 48bit, funky floating point (ffp) format into IEEE-754 format by reverse engineering a 15 year old C program.
Post Edited (Shmoopy) : 3/19/2010 1:01:33 AM GMT