Hi everyone,
I have a little problem with this function from the library Int32 .
When i transform my Int32 to an integer, i obtain a 64 bit integer (normal because my arch is 64 bits).
But the non-relevant bits are all set to one (it seems) in a manner that a value such as
0xfeedface becomes 0x7FFFFFFFfeedface after using the function.
To reproduce the bug you need to :
open Format;;
let f = open_in_bin "some_binary_file";;
let buff = Bytes.init 4 (fun i -> '\x00');;
input f buff 0 4;;
let i = Bytes.get_int32_ne buff 0;;
printf "%X" (Int32.to_int i);;
The same bug happens if you try to read an int from the in_channel using input_binary_in.
Thanks for the help !