https://github.com/hannesm/usane
Unsigned integers for OCaml
https://github.com/hannesm/usane
ocaml unsigned-integers
Last synced: about 1 year ago
JSON representation
Unsigned integers for OCaml
- Host: GitHub
- URL: https://github.com/hannesm/usane
- Owner: hannesm
- License: other
- Created: 2016-08-21T17:59:58.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-22T11:00:36.000Z (about 9 years ago)
- Last Synced: 2025-03-31T13:27:22.293Z (over 1 year ago)
- Topics: ocaml, unsigned-integers
- Language: OCaml
- Size: 54.7 KB
- Stars: 9
- Watchers: 4
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Usane - unsigned integers for OCaml
%%VERSION%%
The behaviour of numbers (int, int32, int64) in OCaml is to be signed, and wrap
around on over/underflow. This library gives explicit access to the carry bit
by using compiler builtins. Other fine integer libraries, such as
[integers](https://github.com/ocamllabs/ocaml-integers) library and
[stdint](https://github.com/andrenth/ocaml-stdint)) mirror the OCaml standard
library behaviour.
This library defines 8, 16, 32, and 64 bit unsigned integers which interoperates
well with the builtin types (int32, int64) by reusing their representation.
Arithmetic operations return the carry bit explicitly.
Some motivating examples are:
```OCaml
# succ max_int
- : int = -4611686018427387904
# pred min_int
- : int = 4611686018427387903
# abs min_int
- : int = -4611686018427387904
```
Usane comes with a extensive test suite to show the behaviour.
Currently this library is not released, I first want to a) use
[ocb-stubblr](https://github.com/pqwy/ocb-stubblr.git) (to get it to run on
MirageOS) and b) test on 32bit.
## Documentation
[](https://travis-ci.org/hannesm/usane)
[API Documentation](https://hannesm.github.io/usane/doc/) is available online.