package ocamlformat-mlx-lib
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=6a40faa182faee55f32bc92387b7e7f97818e160e0f4ef0e0032c0b8b70b86d1
sha512=7df487ebdcddff3529886e034fa9d5476c765c60926b11b8d86fb0e42bea3ee41f693c898e7f95bfc19ca9fa0116825c040a3e027c1e3b7505ebe6c6508540ec
doc/ocamlformat-mlx-lib.ocamlformat_stdlib/Ocamlformat_stdlib/Int_conversions/index.html
Module Ocamlformat_stdlib.Int_conversions
Source
include module type of struct include Base.Int_conversions end
Ocaml has the following integer types, with the following bit widths on 32-bit and 64-bit architectures.
arch arch type 32b 64b ---------------------- int 31 63 (32 when compiled to JavaScript) nativeint 32 64 int32 32 32 int64 64 64
In both cases, the following inequalities hold:
width(int) < width(nativeint)
&& width(int32) <= width(nativeint) <= width(int64)
The conversion functions come in one of two flavors.
If width(foo) <= width(bar) on both 32-bit and 64-bit architectures, then we have
val foo_to_bar : foo -> bar
otherwise we have
val foo_to_bar : foo -> bar option
val foo_to_bar_exn : foo -> bar
human-friendly string (and possibly sexp) conversions
in the output, to_string
, of_string
, sexp_of_t
, and t_of_sexp
convert between t
and signed hexadecimal with an optional "0x" or "0X" prefix.
in the output, to_string
, to_string_hum
, and sexp_of_t
convert t
to an unsigned binary representation with an "0b" prefix.
global ref affecting whether the sexp_of_t
returned by Make
is consistent with the to_string
input or the to_string_hum
output
utility for defining to_string_hum on numeric types -- takes a string matching (-|+)?0-9a-fA-F
+ and puts delimiter
every chars_per_delimiter
characters starting from the right.
insert_delimiter_every ~chars_per_delimiter:3
insert_delimiter ~delimiter:'_'