package extunix
Install
Dune Dependency
Authors
Maintainers
Sources
md5=c2706a62e14f64dbc347d986a38d7b1c
sha256=3ad5c6bfef5d87273f7ba91bf14c4cebee9171439cfacdb06b294427cf034bed
sha512=cccc4808a901284c26e6b268b8536d5dbfe24ccc83bf090fe38e20698647f054573fdfcd1c5709d3aedbe49c6bd45927b317e8b94bb1e8d91d6c22765915bbcb
doc/extunix/ExtUnixSpecific/HostEndian/index.html
Module ExtUnixSpecific.HostEndian
host endian functions
unsafe_get_X str off
extract integer of type X
from string str
starting at offset off
. Unsigned types are 0 extended and signed types are sign extended to fill the ocaml type. Bounds checking is not performed. Use with caution and only when the program logic guarantees that the access is within bounds.
Note: The 31bit functions extract a 32bit integer and return it as ocaml int. On 32bit platforms this can overflow as ocaml integers are 31bit signed there. No error is reported if this occurs. Use with care. Note: The same applies to 63bit functions.
val unsafe_set_uint8 : Bytes.t -> int -> int -> unit
unsafe_set_X buf off v
stores the integer v
as type X
in the buffer buf
starting at offset off
. Bounds checking is not performed. Use with caution and only when the program logic guarantees that the access is within bounds.
Note: The 31bit functions store an ocaml int as 32bit integer. On 32bit platforms ocaml integers are 31bit signed and will be sign extended to 32bit first. Use with care. Note: The same applies to 63bit functions.
val unsafe_set_int8 : Bytes.t -> int -> int -> unit
val unsafe_set_uint16 : Bytes.t -> int -> int -> unit
val unsafe_set_int16 : Bytes.t -> int -> int -> unit
val unsafe_set_uint31 : Bytes.t -> int -> int -> unit
val unsafe_set_int31 : Bytes.t -> int -> int -> unit
val unsafe_set_int32 : Bytes.t -> int -> int32 -> unit
val unsafe_set_uint63 : Bytes.t -> int -> int -> unit
val unsafe_set_int63 : Bytes.t -> int -> int -> unit
val unsafe_set_int64 : Bytes.t -> int -> int64 -> unit
val set_uint8 : Bytes.t -> int -> int -> unit
set_X buf off v
same as unsafe_set_X
but with bounds checking.
val set_int8 : Bytes.t -> int -> int -> unit
val set_uint16 : Bytes.t -> int -> int -> unit
val set_int16 : Bytes.t -> int -> int -> unit
val set_uint31 : Bytes.t -> int -> int -> unit
val set_int31 : Bytes.t -> int -> int -> unit
val set_int32 : Bytes.t -> int -> int32 -> unit
val set_uint63 : Bytes.t -> int -> int -> unit
val set_int63 : Bytes.t -> int -> int -> unit
val set_int64 : Bytes.t -> int -> int64 -> unit