ocaml-trace/src/fuchsia/write/util.ml
2023-12-25 22:52:50 -05:00

5 lines
247 B
OCaml

(** How many bytes are missing for [n] to be a multiple of 8 *)
let[@inline] missing_to_round (n : int) : int = lnot (n - 1) land 0b111
(** Round up to a multiple of 8 *)
let[@inline] round_to_word (n : int) : int = n + (lnot (n - 1) land 0b111)