module Usane:sig
..end
Arithmetic operations on unsigned integers of fixed width may overflow. This library exposes the carry bit of arithmetic operations explicitly: The value of each arithmetic operation is a tuple of the (maybe wrapped) value, and the carry bit.
It is designed for network protocols where sequence numbers are used (and either overflows are accepted or should lead to re-establishing or re-keying of the connection). Most protocols only use simple arithmetic operations, such as a comparison and incrementing by one.
To ease interoperation with other libraries, the representation is the same
width signed representation provided by OCaml, if present (which is the case
for int32
and int64
).
The implementation of usane
uses C compiler builtins
(__builtin_uadd_overflow
etc.). These are available since GCC 5.1 and
Clang 3.4.
6cd1fe8 - homepage
module Uint8:sig
..end
module Uint16:sig
..end
module Uint32:sig
..end
module Uint64:sig
..end