package integers

  1. Overview
  2. Docs
Various signed and unsigned integer types for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

integers-0.2.2.tbz
sha256=937b438e23cedcf06551dbe717cf61ce2a34a573b51bdc2aa0c35b84b8a46121
md5=ae226532930965fe0b43c02f2469cadc

Description

Published: 20 Dec 2016

README

ocaml-integers

The ocaml-integers library provides a number of 8-, 16-, 32- and 64-bit signed and unsigned integer types, together with aliases such as long and size_t whose sizes depend on the host platform.

Features

  • The interfaces follow the pattern of the signatures of the Int32, Int64, and Nativeint modules in the OCaml standard library.

    The behaviour also follows the standard library; for example, conversions such as of_int truncate, and operations are "modulo" in general:

    # Unsigned.UInt8.(pred zero);;
    - : Unsigned.UInt8.t = <uint8 255>
    
  • Top-level printers for each type are included

    # Unsigned.UInt32.[of_int 103; one; of_string "1000"];; 
    - : Unsigned.UInt32.t list = [<uint32 103>; <uint32 1>; <uint32 1000>]
    
  • Infix operators are available:

    # Unsigned.UInt32.(Infix.(one + one));;
    - : Unsigned.UInt32.t = <uint32 2>
    
  • Polymorphic operations such as comparison behave correctly:

    # open Unsigned.UInt32
    # zero < one;;
    - : bool = true
    # max_int < zero;;
    - : bool = false
    
  • Integers 32 bits and above are boxed; integers below 32 bits are unboxed.

    # Obj.(tag (repr Unsigned.UInt32.zero));;
    - : int = 255
    # Obj.(tag (repr Unsigned.UInt16.zero));;
    - : int = 1000
    

API documentation

Dependencies (4)

  1. topkg build
  2. ocamlfind build
  3. ocamlbuild build & != "0.9.0"
  4. ocaml < "5.0"

Dev Dependencies

None

Used by (19)

  1. bls12-381 >= "3.0.0"
  2. bls12-381-unix >= "1.1.0"
  3. class_group_vdf
  4. ctypes >= "0.12.0" & < "0.15.0" | >= "0.21.1"
  5. ctypes-foreign >= "0.21.1"
  6. nsq
  7. octez-libs
  8. owl-base = "0.7.0"
  9. pb
  10. pb-plugin
  11. pkcs11 >= "0.9.0"
  12. posix-base
  13. ppx_cstubs
  14. quickjs
  15. server-reason-react >= "0.3.0"
  16. srt >= "0.2.0"
  17. tezos-sapling >= "11.0"
  18. unix-errno >= "0.6.0"
  19. zstd >= "0.3"

Conflicts

None

OCaml

Innovation. Community. Security.