Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=acbbd5654b6d4af1c1d575ba150fab58
sha512=2dc61cbfef677e669b6169efc483d76a7ca75f013ed02b8b194a4b30681306d4788a153b86e2d0ea725881840426c278c8949dfba752f612152c9d87e9a90565
Description
Small PPX for fixed size integer literals
Added to opam-repository:
README
Stdint literals
This small PPX rewriter allows you to write literals for some of stdint's types using single-character suffixes on integers:
udenotes anuint8Udenotes anuint16idenotes anuint32Idenotes anuint64wdenotes anuint128sdenotes anint8Sdenotes anint16ldenotes anint32(default behavior in OCaml)Ldenotes anint64(default behavior in OCaml)Wdenotes anint128
Usage
Add stdint-literals in your dune file as follows:
(executable
(name example)
(preprocess (pps stdint-literals))
(libraries stdint))Example
let simple_literals =
let i8 = 42u in
Format.printf "%a\n" Stdint.Uint8.printer i8 ;
let i16 = 42U in
Format.printf "%a\n" Stdint.Uint16.printer i16 ;
let s8 = 42s in
Format.printf "%a\n" Stdint.Int8.printer s8 ;
let s16 = 42S in
Format.printf "%a\n" Stdint.Int16.printer s16
let hex_literals =
Format.printf "%a\n" Stdint.Uint16.printer_hex Stdint.Uint16.(0xDDAAU + 0xAADDU)Of course, this also work on hexadecimal (or octal) literals.
Dev Dependencies (1)
-
odoc
with-doc
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building stdint-literals with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. 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 |
|---|---|---|---|---|---|
| 1.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