gcarmix / HexWalk

Hex Viewer/Editor/Analyzer compatible with Linux/Windows/MacOS
https://www.hexwalk.com
GNU General Public License v3.0
719 stars 30 forks source link

Little endian floats #30

Closed amurzeau closed 1 week ago

amurzeau commented 6 months ago

Hi,

It seems that HexWalk decode floats as big endian. Here is Okteta decoding the float as 3.42: image

And here HexWalk decode it as the number I would get as big endian in Okteta: image

Okteta match what I expect while decoding raw little endian values (I encounter little endian more often than big endian).

I guess a solution is to add LE and BE for floats the same way there are LE/BE for Int.

Also, as an additional note, I found that when having a file with only 4 bytes, selecting the 4 bytes won't show me the float value, the 4th byte is not taken into account: image I can create a different issue for this if you prefer separating them.

amurzeau commented 6 months ago

Also, a 3rd note :) Can floats be added to the "Number Converter" dialog (maybe with big/little endian too) ? Maybe it's not its purpose and I would be ok with that.

I encountered a case where I wanted to find the Hex bytes for a given float value. So I used this instead: https://gregstoll.com/~gregstoll/floattohex/

gcarmix commented 6 months ago

@amurzeau, thank you, I added a separate issue for this: #31 as it is a feature request

gcarmix commented 6 months ago

@amurzeau Yes maybe the best would be to have both LE and BE for floats, I'll work on this and also on the bug, thank you

gcarmix commented 1 week ago

Solved with release v1.8.0