package stdint-literals
Small PPX for fixed size integer literals
Install
Dune Dependency
Authors
Maintainers
Sources
1.0.tar.gz
md5=acbbd5654b6d4af1c1d575ba150fab58
sha512=2dc61cbfef677e669b6169efc483d76a7ca75f013ed02b8b194a4b30681306d4788a153b86e2d0ea725881840426c278c8949dfba752f612152c9d87e9a90565
Description
Small PPX for fixed size integer literals
Published: 02 Nov 2022
README
Stdint literals
This small PPX rewriter allows you to write literals for some of stdint's types using single-character suffixes on integers:
u
denotes anuint8
U
denotes anuint16
i
denotes anuint32
I
denotes anuint64
w
denotes anuint128
s
denotes anint8
S
denotes anint16
l
denotes anint32
(default behavior in OCaml)L
denotes anint64
(default behavior in OCaml)W
denotes 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.
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page