module Netnumber:sig
..end
Rtypes
moduleRtypes
moduletype
int4
type
int8
type
uint4
type
uint8
type
fp4
type
fp8
exception Cannot_represent of string
exception Out_of_range
val mk_int4 : char * char * char * char -> int4
val mk_int8 : char * char * char * char * char * char * char * char -> int8
val mk_uint4 : char * char * char * char -> uint4
val mk_uint8 : char * char * char * char * char * char * char * char -> uint8
mk_
<t> create integer values from character tuples. In these tuples
the MSB is the first component and the LSB the last.val dest_int4 : int4 -> char * char * char * char
val dest_int8 : int8 -> char * char * char * char * char * char * char * char
val dest_uint4 : uint4 -> char * char * char * char
val dest_uint8 : uint8 -> char * char * char * char * char * char * char * char
dest_
<t> destroy integer values and returns the corresponding char
tuples.val mk_fp4 : char * char * char * char -> fp4
val mk_fp8 : char * char * char * char * char * char * char * char -> fp8
val dest_fp4 : fp4 -> char * char * char * char
val dest_fp8 : fp8 -> char * char * char * char * char * char * char * char
int
can hold 31-bit signed integers
(including the sign, i.e. one bit cannot be used).
On 64-bit computers, the type int
can hold 63-bit signed integers
(including the sign, i.e. one bit cannot be used).
The int_of_xxx
functions raise Cannot_represent
if the number to
convert is too big (or too small) to be represented as int
. Note
that this depends on the word size of your architecture.val int_of_int4 : int4 -> int
val int_of_uint4 : uint4 -> int
val int_of_int8 : int8 -> int
val int_of_uint8 : uint8 -> int
val int4_of_int : int -> int4
val uint4_of_int : int -> uint4
val int8_of_int : int -> int8
val uint8_of_int : int -> uint8
val int32_of_int4 : int4 -> int32
val int32_of_uint4 : uint4 -> int32
val int32_of_int8 : int8 -> int32
val int32_of_uint8 : uint8 -> int32
val int4_of_int32 : int32 -> int4
val uint4_of_int32 : int32 -> uint4
val int8_of_int32 : int32 -> int8
val uint8_of_int32 : int32 -> uint8
val int64_of_int4 : int4 -> int64
val int64_of_uint4 : uint4 -> int64
val int64_of_int8 : int8 -> int64
val int64_of_uint8 : uint8 -> int64
val int4_of_int64 : int64 -> int4
val uint4_of_int64 : int64 -> uint4
val int8_of_int64 : int64 -> int8
val uint8_of_int64 : int64 -> uint8
uint4
/uint8
to int32
/int64
. Here, the sign is ignored and
simply considered as a bit.val logical_uint4_of_int32 : int32 -> uint4
val logical_int32_of_uint4 : uint4 -> int32
val logical_uint8_of_int64 : int64 -> uint8
val logical_int64_of_uint8 : uint8 -> int64
val fp8_of_fp4 : fp4 -> fp8
val fp4_of_fp8 : fp8 -> fp4
fp4_of_fp8
: This conversion is not exact. It is quite
normal that precision is lost. Numbers too small or too large
for fp4 are converted to the "infinity" value.val float_of_fp4 : fp4 -> float
val float_of_fp8 : fp8 -> float
val fp4_of_float : float -> fp4
val fp8_of_float : float -> fp8
For signed integers, the operators "<", "<=", ">", and ">=" work, too. The unsigned integer type use representation that are not compatible with these operators, and the following functions need to be called.
For fp4
and fp8
there are no comparison functions - convert to
float
first and compare then.
val lt_uint4 : uint4 -> uint4 -> bool
lt_uint4
is true iff the first value is less than the second value
as unsigned intval le_uint4 : uint4 -> uint4 -> bool
val gt_uint4 : uint4 -> uint4 -> bool
val ge_uint4 : uint4 -> uint4 -> bool
val lt_uint8 : uint8 -> uint8 -> bool
lt_uint8
is true iff the first value is less than the second value
as unsigned intval le_uint8 : uint8 -> uint8 -> bool
val gt_uint8 : uint8 -> uint8 -> bool
val ge_uint8 : uint8 -> uint8 -> bool
val min_int4 : int4
val min_uint4 : uint4
val min_int8 : int8
val min_uint8 : uint8
val max_int4 : int4
val max_uint4 : uint4
val max_int8 : int8
val max_uint8 : uint8
module type ENCDEC =sig
..end
module BE:ENCDEC
module LE:ENCDEC
module HO:ENCDEC