package optint
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=295cff2c134b0385b13ba81d5005d9f841ba40d4a502aed10c997f239ef1147b
sha512=15ec97a076584e8ea28c589f1db3b9a0dd6fd5a7950528a1d136761cc13bca0e6e7bf6e0f87c73578a37393c213a7a0f3e7beaabd924e176459b29af52b8dd11
Description
This library provides two new integer types, Optint.t and Int63.t, which
guarantee efficient representation on 64-bit architectures and provide a
best-effort boxed representation on 32-bit architectures.
Implementation depends on target architecture.
Added to opam-repository:
README
Optint - Efficient integer types on 64-bit architectures
This library provides two new integer types, Optint.t and Int63.t, which guarantee efficient representation on 64-bit architectures and provide a best-effort boxed representation on 32-bit architectures.
Goal
The standard Int32.t and Int64.t types provided by the standard library have the same heap-allocated representation on all architectures. This consistent representation has costs in both memory and run-time performance.
On 64-bit architectures, it's often more efficient to use the native int directly. This library provides types to do exactly this:
Optint.t: an integer containing at least 32 bits. On 64-bit, this is an immediate integer; on 32-bit, it is a boxed 32-bit value. The overflow behaviour is platform-dependent.Int63.t: an integer containing exactly 63 bits. On 64-bit, this is an immediate integer; on 32-bit, it is a boxed 64-bit integer that is wrapped to provide 63-bit two's complement semantics. The two implementations are observationally equivalent, modulo use ofMarshalandObj.
In summary:
Integer type | 32-bit representation | 64-bit representation | Semantics |
|---|---|---|---|
| 31-bit immediate ✅ | 63-bit immediate ✅ | Always immediate |
| 32-bit boxed ❌ | 64-bit boxed ❌ | Exactly word size |
| 32-bit boxed ❌ | 32-bit boxed ❌ | Exactly 32 bits |
| 64-bit boxed ❌ | 64-bit boxed ❌ | Exactly 64 bits |
| 32-bit boxed ❌ | 63-bit immediate ✅ | At least 32 bits |
| 64-bit boxed ❌ | 63-bit immediate ✅ | Exactly 63 bits |
These new types are safe and well-tested, but their architecture-dependent implementation makes them unsuitable for use with the Marshal module. Use the provided encode and decode functions instead.
Optional Dependencies
None
Used by (26)
- cactus
- carton
-
carton-lwt
< "1.0.0" - chamelon
-
checkseum
>= "0.3.1" - decompress
- eio
-
git
>= "3.2.0" -
index
>= "1.4.0" -
index-bench
>= "1.4.0" - irmin-pack
- irmin-server
-
mirage-kv
>= "6.0.1" -
mirage-kv-mem
>= "3.2.1" -
mirage-kv-unix
>= "3.0.0" - multibase
- oneffs
- ppx_optint
-
ppx_repr
>= "0.5.0" -
progress
>= "0.2.0" -
repr
>= "0.5.0" -
rfc1951
< "1.0.0" | >= "1.3.0" - tar-mirage
- uring
-
wire
>= "1.1.0" - wu-manber-fuzzy-search
Conflicts
None
Build status
Results of building optint with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.3.0 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure