It seems that the fast path and slow path for extracting int64 in littleendian are inconsistent. I have the following program, where I expect f and g to print the result.
let f bits =
match%bitstring bits with
| {| a:4; b:60:littleendian; _:-1:bitstring |} ->
print_string (Int.to_string a);
print_endline "";
print_string (Int64.to_string b);
print_endline ""
| {|_|} -> failwith "run_test5"
;;
let g bits =
match%bitstring bits with
| {| b:60:littleendian; a:4; _:-1:bitstring |} ->
print_string (Int.to_string a);
print_endline "";
print_string (Int64.to_string b);
print_endline ""
| {|_|} -> failwith "run_test6"
;;
let () =
f (Bitstring.bitstring_of_string "\xA0\x00\x00\x00\x00\x00\x00\x00");
g (Bitstring.bitstring_of_string "\x00\x00\x00\x00\x00\x00\x00\x0A")
;;
However, the result I got is:
10
0
10
720575940379279360
It seems the fast path for extracting int64 does not properly handle the case when reading less than 64 bit. Or did I misunderstand anything?
It seems that the fast path and slow path for extracting int64 in littleendian are inconsistent. I have the following program, where I expect
fandgto print the result.However, the result I got is:
It seems the fast path for extracting int64 does not properly handle the case when reading less than 64 bit. Or did I misunderstand anything?