Skip to content

Commit

Permalink
Buf_write: Fix BE.uint48 and LE.uint48.
Browse files Browse the repository at this point in the history
Arguments to logical shift are provided in bits, not bytes.
  • Loading branch information
adatario committed Jan 27, 2023
1 parent 80f5352 commit de0a4bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib_eio/buf_write.ml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ module BE = struct
writable_exn t;
ensure_space t 6;
Bigstringaf.unsafe_set_int32_be t.buffer t.write_pos
Int64.(to_int32 (shift_right_logical i 4));
Int64.(to_int32 (shift_right_logical i 32));
Bigstringaf.unsafe_set_int16_be t.buffer (t.write_pos + 2)
Int64.(to_int i);
advance_pos t 6
Expand Down Expand Up @@ -325,7 +325,7 @@ module LE = struct
Bigstringaf.unsafe_set_int16_le t.buffer t.write_pos
Int64.(to_int i);
Bigstringaf.unsafe_set_int32_le t.buffer (t.write_pos + 2)
Int64.(to_int32 (shift_right_logical i 2));
Int64.(to_int32 (shift_right_logical i 16));
advance_pos t 6

let uint64 t i =
Expand Down

0 comments on commit de0a4bc

Please sign in to comment.