Skip to content

Commit

Permalink
Merge pull request #144 from hhugo/fix-for-jsoo
Browse files Browse the repository at this point in the history
Fix primitives used for bytes
  • Loading branch information
dinosaure authored Mar 23, 2023
2 parents 1eff5c5 + d76e84a commit cc2bb53
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/digestif_by.ml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
include Bytes

external unsafe_get_32 : t -> int -> int32 = "%caml_string_get32u"
external unsafe_get_64 : t -> int -> int64 = "%caml_string_get64u"
external unsafe_get_32 : t -> int -> int32 = "%caml_bytes_get32u"
external unsafe_get_64 : t -> int -> int64 = "%caml_bytes_get64u"

let unsafe_get_nat : t -> int -> nativeint =
fun s i ->
if Sys.word_size = 32
then Nativeint.of_int32 @@ unsafe_get_32 s i
else Int64.to_nativeint @@ unsafe_get_64 s i

external unsafe_set_32 : t -> int -> int32 -> unit = "%caml_string_set32u"
external unsafe_set_64 : t -> int -> int64 -> unit = "%caml_string_set64u"
external unsafe_set_32 : t -> int -> int32 -> unit = "%caml_bytes_set32u"
external unsafe_set_64 : t -> int -> int64 -> unit = "%caml_bytes_set64u"

let unsafe_set_nat : t -> int -> nativeint -> unit =
fun s i v ->
Expand Down

0 comments on commit cc2bb53

Please # to comment.