I want to swap my float exemple: 14 D7 65 01 ----> 65 01 14 D7
The swap is easy to do. I work on a DWORD, I made my swap and then I cast my DWORD variable to float. The problem I have is that the float value is wrong. I am sure that The DWORD swap is ok and well done. I think that the cast is made badly. Any help is more than welcome! Thank you in advance!
Here is the core of the code:
DWORD value = 0x713D2242;
value =(LOWORD(value)<<16)+ HIWORD (value);
float fvalue = (float)value;
I donot know why but I found a solution from a book which casting a float number to a DWORD number:
float f = ...;
DOWRD dw;
dw = *((DWORD*)&F);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With