diff --git a/lib/utils.ml b/lib/utils.ml index 6e75aeb..144473c 100644 --- a/lib/utils.ml +++ b/lib/utils.ml @@ -33,4 +33,12 @@ let unpack_short_be data offset = (msb lsl 8) + lsb ;; +let unpack_int_be data offset = + let byte1 = int_of_char (Bytes.get data offset) in + let byte2 = int_of_char (Bytes.get data (offset + 1)) in + let byte3 = int_of_char (Bytes.get data (offset + 2)) in + let byte4 = int_of_char (Bytes.get data (offset + 3)) in + (byte1 lsl 24) lor (byte2 lsl 16) lor (byte3 lsl 8) lor byte4 +;; + let bytes_forward data offset = Bytes.sub data offset (Bytes.length data - offset)