Plasma GitLab Archive
Projects Blog Knowledge

Module Netnumber.BE

module BE: ENCDEC 

Encoders/decoders for big endian - network byte order


Encode/decode numbers as strings. These functions exist in two flavors:

val read_int4 : Stdlib.Bytes.t -> int -> Netnumber.int4
val read_int8 : Stdlib.Bytes.t -> int -> Netnumber.int8
val read_uint4 : Stdlib.Bytes.t -> int -> Netnumber.uint4
val read_uint8 : Stdlib.Bytes.t -> int -> Netnumber.uint8

read_<t> create integer values from the characters found at a certain position in the string. Raises Out_of_range if the position is bad

val read_int4_unsafe : Stdlib.Bytes.t -> int -> Netnumber.int4
val read_int8_unsafe : Stdlib.Bytes.t -> int -> Netnumber.int8
val read_uint4_unsafe : Stdlib.Bytes.t -> int -> Netnumber.uint4
val read_uint8_unsafe : Stdlib.Bytes.t -> int -> Netnumber.uint8

Same, but no index check

val read_string_int4 : string -> int -> Netnumber.int4
val read_string_int8 : string -> int -> Netnumber.int8
val read_string_uint4 : string -> int -> Netnumber.uint4
val read_string_uint8 : string -> int -> Netnumber.uint8
val read_string_int4_unsafe : string -> int -> Netnumber.int4
val read_string_int8_unsafe : string -> int -> Netnumber.int8
val read_string_uint4_unsafe : string -> int -> Netnumber.uint4
val read_string_uint8_unsafe : string -> int -> Netnumber.uint8

For immutable strings

val write_int4 : Stdlib.Bytes.t -> int -> Netnumber.int4 -> unit
val write_int8 : Stdlib.Bytes.t -> int -> Netnumber.int8 -> unit
val write_uint4 : Stdlib.Bytes.t -> int -> Netnumber.uint4 -> unit
val write_uint8 : Stdlib.Bytes.t -> int -> Netnumber.uint8 -> unit

write_<t> copies the characters corresponding to the integer values into the string at the given positions. Raises Out_of_range if the position is bad.

val write_int4_unsafe : Stdlib.Bytes.t -> int -> Netnumber.int4 -> unit
val write_int8_unsafe : Stdlib.Bytes.t -> int -> Netnumber.int8 -> unit
val write_uint4_unsafe : Stdlib.Bytes.t -> int -> Netnumber.uint4 -> unit
val write_uint8_unsafe : Stdlib.Bytes.t -> int -> Netnumber.uint8 -> unit

write_<t>_unsafe: Same, but no index check.

val int4_as_bytes : Netnumber.int4 -> Stdlib.Bytes.t
val int8_as_bytes : Netnumber.int8 -> Stdlib.Bytes.t
val uint4_as_bytes : Netnumber.uint4 -> Stdlib.Bytes.t
val uint8_as_bytes : Netnumber.uint8 -> Stdlib.Bytes.t

<t>_as_bytes: Returns the corresponding bytes for an integer value

val int4_as_string : Netnumber.int4 -> string
val int8_as_string : Netnumber.int8 -> string
val uint4_as_string : Netnumber.uint4 -> string
val uint8_as_string : Netnumber.uint8 -> string

<t>_as_string: Returns the corresponding string for an integer value

val write_fp4 : Stdlib.Bytes.t -> int -> Netnumber.fp4 -> unit
val write_fp8 : Stdlib.Bytes.t -> int -> Netnumber.fp8 -> unit
val fp4_as_string : Netnumber.fp4 -> string
val fp8_as_string : Netnumber.fp8 -> string
val fp4_as_bytes : Netnumber.fp4 -> Stdlib.Bytes.t
val fp8_as_bytes : Netnumber.fp8 -> Stdlib.Bytes.t
val read_fp4 : Stdlib.Bytes.t -> int -> Netnumber.fp4
val read_fp8 : Stdlib.Bytes.t -> int -> Netnumber.fp8
val read_string_fp4 : string -> int -> Netnumber.fp4
val read_string_fp8 : string -> int -> Netnumber.fp8
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml