package uint

  1. Overview
  2. Docs
Deprecated: An unsigned integer library

Install

Dune Dependency

Authors

Maintainers

Sources

2.0.1.tar.gz
md5=3cec2efa58139a94dbc74366281d8e38
sha512=6ecb73813b6636c631a1ea4aa8994f3285e8b5e22e35f33828534b05b1f6f9d54f1f38f822a3512e95bbdba92cc8ee98df472fcbeb9884aeeefc73c038d9084a

doc/src/uint/uint8.ml.html

Source file uint8.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
open Stdint

type uint8 = Uint8.t
type t = uint8

let add = Uint8.add
let sub = Uint8.sub
let mul = Uint8.mul
let div = Uint8.div
let rem = Uint8.rem
let logand = Uint8.logand
let logor = Uint8.logor
let logxor = Uint8.logxor
let lognot = Uint8.lognot
let shift_left = Uint8.shift_left
let shift_right = Uint8.shift_right
let of_int = Uint8.of_int
let to_int = Uint8.to_int
let of_float = Uint8.of_float
let to_float = Uint8.to_float
let of_int32 = Uint8.of_int32
let to_int32 = Uint8.to_int32
let bits_of_float = Uint8.of_float (* This may cause issues *)
let float_of_bits = Uint8.to_float (* This may cause issues *)

let zero = of_int 0
let one = of_int 1
let succ = Uint8.succ
let pred = Uint8.pred
let max_int = Uint8.max_int
let min_int = Uint8.min_int

module Conv = Uint.Str_conv.Make(struct
  type t      = uint8
  let fmt     = "Ul"
  let name    = "Uint8"
  let zero    = zero
  let max_int = max_int
  let bits    = 8
  let of_int  = of_int
  let to_int  = to_int
  let add     = add
  let mul     = mul
  let divmod  = (fun x y -> div x y, rem x y)
end)

let of_string = Conv.of_string
let to_string = Conv.to_string
let to_string_bin = Conv.to_string_bin
let to_string_oct = Conv.to_string_oct
let to_string_hex = Conv.to_string_hex
let printer = Conv.printer
let printer_bin = Conv.printer_bin
let printer_oct = Conv.printer_oct
let printer_hex = Conv.printer_hex

let compare = Stdlib.compare
OCaml

Innovation. Community. Security.