man-pages/man3/StdLabels.Bytes.3o.html
2021-03-31 01:06:50 +01:00

2194 lines
22 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of StdLabels.Bytes</TITLE>
</HEAD><BODY>
<H1>StdLabels.Bytes</H1>
Section: OCaml library (3o)<BR>Updated: 2020-01-30<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
StdLabels.Bytes - no description
<A NAME="lbAC">&nbsp;</A>
<H2>Module</H2>
Module StdLabels.Bytes
<A NAME="lbAD">&nbsp;</A>
<H2>Documentation</H2>
<P>
Module
<B>Bytes</B>
<BR>&nbsp;:&nbsp;
<B>(module BytesLabels)</B>
<P>
<P>
<P>
<P>
<P>
<P>
<P>
<P>
<I>val length </I>
:
<B>bytes -&gt; int</B>
<P>
Return the length (number of bytes) of the argument.
<P>
<P>
<P>
<I>val get </I>
:
<B>bytes -&gt; int -&gt; char</B>
<P>
<P>
<B>get s n</B>
returns the byte at index
<B>n</B>
in argument
<B>s</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>n</B>
is not a valid index in
<B>s</B>
.
<P>
<P>
<P>
<I>val set </I>
:
<B>bytes -&gt; int -&gt; char -&gt; unit</B>
<P>
<P>
<B>set s n c</B>
modifies
<B>s</B>
in place, replacing the byte at index
<B>n</B>
with
<B>c</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>n</B>
is not a valid index in
<B>s</B>
.
<P>
<P>
<P>
<I>val create </I>
:
<B>int -&gt; bytes</B>
<P>
<P>
<B>create n</B>
returns a new byte sequence of length
<B>n</B>
. The
sequence is uninitialized and contains arbitrary bytes.
<P>
Raise
<B>Invalid_argument</B>
if
<B>n &lt; 0</B>
or
<B>n &gt; </B>
<B>Sys.max_string_length</B>
.
<P>
<P>
<P>
<I>val make </I>
:
<B>int -&gt; char -&gt; bytes</B>
<P>
<P>
<B>make n c</B>
returns a new byte sequence of length
<B>n</B>
, filled with
the byte
<B>c</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>n &lt; 0</B>
or
<B>n &gt; </B>
<B>Sys.max_string_length</B>
.
<P>
<P>
<P>
<I>val init </I>
:
<B>int -&gt; f:(int -&gt; char) -&gt; bytes</B>
<P>
<P>
<B>init n f</B>
returns a fresh byte sequence of length
<B>n</B>
,
with character
<B>i</B>
initialized to the result of
<B>f i</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>n &lt; 0</B>
or
<B>n &gt; </B>
<B>Sys.max_string_length</B>
.
<P>
<P>
<P>
<I>val empty </I>
:
<B>bytes</B>
<P>
A byte sequence of size 0.
<P>
<P>
<P>
<I>val copy </I>
:
<B>bytes -&gt; bytes</B>
<P>
Return a new byte sequence that contains the same bytes as the
argument.
<P>
<P>
<P>
<I>val of_string </I>
:
<B>string -&gt; bytes</B>
<P>
Return a new byte sequence that contains the same bytes as the
given string.
<P>
<P>
<P>
<I>val to_string </I>
:
<B>bytes -&gt; string</B>
<P>
Return a new string that contains the same bytes as the given byte
sequence.
<P>
<P>
<P>
<I>val sub </I>
:
<B>bytes -&gt; pos:int -&gt; len:int -&gt; bytes</B>
<P>
<P>
<B>sub s start len</B>
returns a new byte sequence of length
<B>len</B>
,
containing the subsequence of
<B>s</B>
that starts at position
<B>start</B>
and has length
<B>len</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>start</B>
and
<B>len</B>
do not designate a
valid range of
<B>s</B>
.
<P>
<P>
<P>
<I>val sub_string </I>
:
<B>bytes -&gt; pos:int -&gt; len:int -&gt; string</B>
<P>
Same as
<B>sub</B>
but return a string instead of a byte sequence.
<P>
<P>
<P>
<I>val extend </I>
:
<B>bytes -&gt; left:int -&gt; right:int -&gt; bytes</B>
<P>
<P>
<B>extend s left right</B>
returns a new byte sequence that contains
the bytes of
<B>s</B>
, with
<B>left</B>
uninitialized bytes prepended and
<B>right</B>
uninitialized bytes appended to it. If
<B>left</B>
or
<B>right</B>
is negative, then bytes are removed (instead of appended) from
the corresponding side of
<B>s</B>
.
<P>
Raise
<B>Invalid_argument</B>
if the result length is negative or
longer than
<B>Sys.max_string_length</B>
bytes.
<P>
<P>
<B>Since</B>
4.05.0
<P>
<P>
<P>
<I>val fill </I>
:
<B>bytes -&gt; pos:int -&gt; len:int -&gt; char -&gt; unit</B>
<P>
<P>
<B>fill s start len c</B>
modifies
<B>s</B>
in place, replacing
<B>len</B>
characters with
<B>c</B>
, starting at
<B>start</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>start</B>
and
<B>len</B>
do not designate a
valid range of
<B>s</B>
.
<P>
<P>
<P>
<I>val blit </I>
:
<B>src:bytes -&gt; src_pos:int -&gt; dst:bytes -&gt; dst_pos:int -&gt; len:int -&gt; unit</B>
<P>
<P>
<B>blit src srcoff dst dstoff len</B>
copies
<B>len</B>
bytes from sequence
<B>src</B>
, starting at index
<B>srcoff</B>
, to sequence
<B>dst</B>
, starting at
index
<B>dstoff</B>
. It works correctly even if
<B>src</B>
and
<B>dst</B>
are the
same byte sequence, and the source and destination intervals
overlap.
<P>
Raise
<B>Invalid_argument</B>
if
<B>srcoff</B>
and
<B>len</B>
do not
designate a valid range of
<B>src</B>
, or if
<B>dstoff</B>
and
<B>len</B>
do not designate a valid range of
<B>dst</B>
.
<P>
<P>
<P>
<I>val blit_string </I>
:
<B>src:string -&gt; src_pos:int -&gt; dst:bytes -&gt; dst_pos:int -&gt; len:int -&gt; unit</B>
<P>
<P>
<B>blit src srcoff dst dstoff len</B>
copies
<B>len</B>
bytes from string
<B>src</B>
, starting at index
<B>srcoff</B>
, to byte sequence
<B>dst</B>
,
starting at index
<B>dstoff</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>srcoff</B>
and
<B>len</B>
do not
designate a valid range of
<B>src</B>
, or if
<B>dstoff</B>
and
<B>len</B>
do not designate a valid range of
<B>dst</B>
.
<P>
<P>
<B>Since</B>
4.05.0
<P>
<P>
<P>
<I>val concat </I>
:
<B>sep:bytes -&gt; bytes list -&gt; bytes</B>
<P>
<P>
<B>concat sep sl</B>
concatenates the list of byte sequences
<B>sl</B>
,
inserting the separator byte sequence
<B>sep</B>
between each, and
returns the result as a new byte sequence.
<P>
<P>
<P>
<I>val cat </I>
:
<B>bytes -&gt; bytes -&gt; bytes</B>
<P>
<P>
<B>cat s1 s2</B>
concatenates
<B>s1</B>
and
<B>s2</B>
and returns the result
as new byte sequence.
<P>
Raise
<B>Invalid_argument</B>
if the result is longer than
<B>Sys.max_string_length</B>
bytes.
<P>
<P>
<B>Since</B>
4.05.0
<P>
<P>
<P>
<I>val iter </I>
:
<B>f:(char -&gt; unit) -&gt; bytes -&gt; unit</B>
<P>
<P>
<B>iter f s</B>
applies function
<B>f</B>
in turn to all the bytes of
<B>s</B>
.
It is equivalent to
<B>f (get s 0); f (get s 1); ...; f (get s</B>
<B>(length s - 1)); ()</B>
.
<P>
<P>
<P>
<I>val iteri </I>
:
<B>f:(int -&gt; char -&gt; unit) -&gt; bytes -&gt; unit</B>
<P>
Same as
<B>Bytes.iter</B>
, but the function is applied to the index of
the byte as first argument and the byte itself as second
argument.
<P>
<P>
<P>
<I>val map </I>
:
<B>f:(char -&gt; char) -&gt; bytes -&gt; bytes</B>
<P>
<P>
<B>map f s</B>
applies function
<B>f</B>
in turn to all the bytes of
<B>s</B>
and
stores the resulting bytes in a new sequence that is returned as
the result.
<P>
<P>
<P>
<I>val mapi </I>
:
<B>f:(int -&gt; char -&gt; char) -&gt; bytes -&gt; bytes</B>
<P>
<P>
<B>mapi f s</B>
calls
<B>f</B>
with each character of
<B>s</B>
and its
index (in increasing index order) and stores the resulting bytes
in a new sequence that is returned as the result.
<P>
<P>
<P>
<I>val trim </I>
:
<B>bytes -&gt; bytes</B>
<P>
Return a copy of the argument, without leading and trailing
whitespace. The bytes regarded as whitespace are the ASCII
characters
<B>' '</B>
,
<B>'\012'</B>
,
<B>'\n'</B>
,
<B>'\r'</B>
, and
<B>'\t'</B>
.
<P>
<P>
<P>
<I>val escaped </I>
:
<B>bytes -&gt; bytes</B>
<P>
Return a copy of the argument, with special characters represented
by escape sequences, following the lexical conventions of OCaml.
<P>
<P>
<P>
<I>val index </I>
:
<B>bytes -&gt; char -&gt; int</B>
<P>
<P>
<B>index s c</B>
returns the index of the first occurrence of byte
<B>c</B>
in
<B>s</B>
.
<P>
Raise
<B>Not_found</B>
if
<B>c</B>
does not occur in
<B>s</B>
.
<P>
<P>
<P>
<I>val index_opt </I>
:
<B>bytes -&gt; char -&gt; int option</B>
<P>
<P>
<B>index_opt s c</B>
returns the index of the first occurrence of byte
<B>c</B>
in
<B>s</B>
or
<B>None</B>
if
<B>c</B>
does not occur in
<B>s</B>
.
<P>
<P>
<B>Since</B>
4.05
<P>
<P>
<P>
<I>val rindex </I>
:
<B>bytes -&gt; char -&gt; int</B>
<P>
<P>
<B>rindex s c</B>
returns the index of the last occurrence of byte
<B>c</B>
in
<B>s</B>
.
<P>
Raise
<B>Not_found</B>
if
<B>c</B>
does not occur in
<B>s</B>
.
<P>
<P>
<P>
<I>val rindex_opt </I>
:
<B>bytes -&gt; char -&gt; int option</B>
<P>
<P>
<B>rindex_opt s c</B>
returns the index of the last occurrence of byte
<B>c</B>
in
<B>s</B>
or
<B>None</B>
if
<B>c</B>
does not occur in
<B>s</B>
.
<P>
<P>
<B>Since</B>
4.05
<P>
<P>
<P>
<I>val index_from </I>
:
<B>bytes -&gt; int -&gt; char -&gt; int</B>
<P>
<P>
<B>index_from s i c</B>
returns the index of the first occurrence of
byte
<B>c</B>
in
<B>s</B>
after position
<B>i</B>
.
<B>Bytes.index s c</B>
is
equivalent to
<B>Bytes.index_from s 0 c</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>i</B>
is not a valid position in
<B>s</B>
.
Raise
<B>Not_found</B>
if
<B>c</B>
does not occur in
<B>s</B>
after position
<B>i</B>
.
<P>
<P>
<P>
<I>val index_from_opt </I>
:
<B>bytes -&gt; int -&gt; char -&gt; int option</B>
<P>
<P>
<B>index_from _opts i c</B>
returns the index of the first occurrence of
byte
<B>c</B>
in
<B>s</B>
after position
<B>i</B>
or
<B>None</B>
if
<B>c</B>
does not occur in
<B>s</B>
after position
<B>i</B>
.
<B>Bytes.index_opt s c</B>
is equivalent to
<B>Bytes.index_from_opt s 0 c</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>i</B>
is not a valid position in
<B>s</B>
.
<P>
<P>
<B>Since</B>
4.05
<P>
<P>
<P>
<I>val rindex_from </I>
:
<B>bytes -&gt; int -&gt; char -&gt; int</B>
<P>
<P>
<B>rindex_from s i c</B>
returns the index of the last occurrence of
byte
<B>c</B>
in
<B>s</B>
before position
<B>i+1</B>
.
<B>rindex s c</B>
is equivalent
to
<B>rindex_from s (Bytes.length s - 1) c</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>i+1</B>
is not a valid position in
<B>s</B>
.
Raise
<B>Not_found</B>
if
<B>c</B>
does not occur in
<B>s</B>
before position
<B>i+1</B>
.
<P>
<P>
<P>
<I>val rindex_from_opt </I>
:
<B>bytes -&gt; int -&gt; char -&gt; int option</B>
<P>
<P>
<B>rindex_from_opt s i c</B>
returns the index of the last occurrence
of byte
<B>c</B>
in
<B>s</B>
before position
<B>i+1</B>
or
<B>None</B>
if
<B>c</B>
does not
occur in
<B>s</B>
before position
<B>i+1</B>
.
<B>rindex_opt s c</B>
is equivalent to
<B>rindex_from s (Bytes.length s - 1) c</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>i+1</B>
is not a valid position in
<B>s</B>
.
<P>
<P>
<B>Since</B>
4.05
<P>
<P>
<P>
<I>val contains </I>
:
<B>bytes -&gt; char -&gt; bool</B>
<P>
<P>
<B>contains s c</B>
tests if byte
<B>c</B>
appears in
<B>s</B>
.
<P>
<P>
<P>
<I>val contains_from </I>
:
<B>bytes -&gt; int -&gt; char -&gt; bool</B>
<P>
<P>
<B>contains_from s start c</B>
tests if byte
<B>c</B>
appears in
<B>s</B>
after
position
<B>start</B>
.
<B>contains s c</B>
is equivalent to
<B>contains_from</B>
<B>s 0 c</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>start</B>
is not a valid position in
<B>s</B>
.
<P>
<P>
<P>
<I>val rcontains_from </I>
:
<B>bytes -&gt; int -&gt; char -&gt; bool</B>
<P>
<P>
<B>rcontains_from s stop c</B>
tests if byte
<B>c</B>
appears in
<B>s</B>
before
position
<B>stop+1</B>
.
<P>
Raise
<B>Invalid_argument</B>
if
<B>stop &lt; 0</B>
or
<B>stop+1</B>
is not a valid
position in
<B>s</B>
.
<P>
<P>
<P>
<I>val uppercase </I>
:
<B>bytes -&gt; bytes</B>
<P>
<B>Deprecated.</B>
Functions operating on Latin-1 character set are deprecated.
<P>
<P>
Return a copy of the argument, with all lowercase letters
translated to uppercase, including accented letters of the ISO
Latin-1 (8859-1) character set.
<P>
<P>
<P>
<I>val lowercase </I>
:
<B>bytes -&gt; bytes</B>
<P>
<B>Deprecated.</B>
Functions operating on Latin-1 character set are deprecated.
<P>
<P>
Return a copy of the argument, with all uppercase letters
translated to lowercase, including accented letters of the ISO
Latin-1 (8859-1) character set.
<P>
<P>
<P>
<I>val capitalize </I>
:
<B>bytes -&gt; bytes</B>
<P>
<B>Deprecated.</B>
Functions operating on Latin-1 character set are deprecated.
<P>
<P>
Return a copy of the argument, with the first character set to uppercase,
using the ISO Latin-1 (8859-1) character set..
<P>
<P>
<P>
<I>val uncapitalize </I>
:
<B>bytes -&gt; bytes</B>
<P>
<B>Deprecated.</B>
Functions operating on Latin-1 character set are deprecated.
<P>
<P>
Return a copy of the argument, with the first character set to lowercase,
using the ISO Latin-1 (8859-1) character set..
<P>
<P>
<P>
<I>val uppercase_ascii </I>
:
<B>bytes -&gt; bytes</B>
<P>
Return a copy of the argument, with all lowercase letters
translated to uppercase, using the US-ASCII character set.
<P>
<P>
<B>Since</B>
4.05.0
<P>
<P>
<P>
<I>val lowercase_ascii </I>
:
<B>bytes -&gt; bytes</B>
<P>
Return a copy of the argument, with all uppercase letters
translated to lowercase, using the US-ASCII character set.
<P>
<P>
<B>Since</B>
4.05.0
<P>
<P>
<P>
<I>val capitalize_ascii </I>
:
<B>bytes -&gt; bytes</B>
<P>
Return a copy of the argument, with the first character set to uppercase,
using the US-ASCII character set.
<P>
<P>
<B>Since</B>
4.05.0
<P>
<P>
<P>
<I>val uncapitalize_ascii </I>
:
<B>bytes -&gt; bytes</B>
<P>
Return a copy of the argument, with the first character set to lowercase,
using the US-ASCII character set.
<P>
<P>
<B>Since</B>
4.05.0
<P>
<P>
<I>type t </I>
=
<B>bytes</B>
<P>
<P>
An alias for the type of byte sequences.
<P>
<P>
<P>
<I>val compare </I>
:
<B>t -&gt; t -&gt; int</B>
<P>
The comparison function for byte sequences, with the same
specification as
<B>compare</B>
. Along with the type
<B>t</B>
,
this function
<B>compare</B>
allows the module
<B>Bytes</B>
to be passed as
argument to the functors
<B>Set.Make</B>
and
<B>Map.Make</B>
.
<P>
<P>
<P>
<I>val equal </I>
:
<B>t -&gt; t -&gt; bool</B>
<P>
The equality function for byte sequences.
<P>
<P>
<B>Since</B>
4.05.0
<P>
<P>
<P>
<P>
<A NAME="lbAE">&nbsp;</A>
<H3>Iterators</H3>
<P>
<P>
<P>
<I>val to_seq </I>
:
<B>t -&gt; char Seq.t</B>
<P>
Iterate on the string, in increasing index order. Modifications of the
string during iteration will be reflected in the iterator.
<P>
<P>
<B>Since</B>
4.07
<P>
<P>
<P>
<I>val to_seqi </I>
:
<B>t -&gt; (int * char) Seq.t</B>
<P>
Iterate on the string, in increasing order, yielding indices along chars
<P>
<P>
<B>Since</B>
4.07
<P>
<P>
<P>
<I>val of_seq </I>
:
<B>char Seq.t -&gt; t</B>
<P>
Create a string from the generator
<P>
<P>
<B>Since</B>
4.07
<P>
<P>
<P>
<P>
<A NAME="lbAF">&nbsp;</A>
<H3>Binary encoding/decoding of integers</H3>
<P>
<P>
<P>
<P>
The functions in this section binary encode and decode integers to
and from byte sequences.
<P>
All following functions raise
<B>Invalid_argument</B>
if the space
needed at index
<B>i</B>
to decode or encode the integer is not
available.
<P>
Little-endian (resp. big-endian) encoding means that least
(resp. most) significant bytes are stored first. Big-endian is
also known as network byte order. Native-endian encoding is
either little-endian or big-endian depending on
<B>Sys.big_endian</B>
.
<P>
32-bit and 64-bit integers are represented by the
<B>int32</B>
and
<B>int64</B>
types, which can be interpreted either as signed or
unsigned numbers.
<P>
8-bit and 16-bit integers are represented by the
<B>int</B>
type,
which has more bits than the binary encoding. These extra bits
are handled as follows:
<P>
-Functions that decode signed (resp. unsigned) 8-bit or 16-bit
integers represented by
<B>int</B>
values sign-extend
(resp. zero-extend) their result.
<P>
-Functions that encode 8-bit or 16-bit integers represented by
<B>int</B>
values truncate their input to their least significant
bytes.
<P>
<P>
<P>
<I>val get_uint8 </I>
:
<B>bytes -&gt; int -&gt; int</B>
<P>
<P>
<B>get_uint8 b i</B>
is
<B>b</B>
's unsigned 8-bit integer starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_int8 </I>
:
<B>bytes -&gt; int -&gt; int</B>
<P>
<P>
<B>get_int8 b i</B>
is
<B>b</B>
's signed 8-bit integer starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_uint16_ne </I>
:
<B>bytes -&gt; int -&gt; int</B>
<P>
<P>
<B>get_uint16_ne b i</B>
is
<B>b</B>
's native-endian unsigned 16-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_uint16_be </I>
:
<B>bytes -&gt; int -&gt; int</B>
<P>
<P>
<B>get_uint16_be b i</B>
is
<B>b</B>
's big-endian unsigned 16-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_uint16_le </I>
:
<B>bytes -&gt; int -&gt; int</B>
<P>
<P>
<B>get_uint16_le b i</B>
is
<B>b</B>
's little-endian unsigned 16-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_int16_ne </I>
:
<B>bytes -&gt; int -&gt; int</B>
<P>
<P>
<B>get_int16_ne b i</B>
is
<B>b</B>
's native-endian signed 16-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_int16_be </I>
:
<B>bytes -&gt; int -&gt; int</B>
<P>
<P>
<B>get_int16_be b i</B>
is
<B>b</B>
's big-endian signed 16-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_int16_le </I>
:
<B>bytes -&gt; int -&gt; int</B>
<P>
<P>
<B>get_int16_le b i</B>
is
<B>b</B>
's little-endian signed 16-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_int32_ne </I>
:
<B>bytes -&gt; int -&gt; int32</B>
<P>
<P>
<B>get_int32_ne b i</B>
is
<B>b</B>
's native-endian 32-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_int32_be </I>
:
<B>bytes -&gt; int -&gt; int32</B>
<P>
<P>
<B>get_int32_be b i</B>
is
<B>b</B>
's big-endian 32-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_int32_le </I>
:
<B>bytes -&gt; int -&gt; int32</B>
<P>
<P>
<B>get_int32_le b i</B>
is
<B>b</B>
's little-endian 32-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_int64_ne </I>
:
<B>bytes -&gt; int -&gt; int64</B>
<P>
<P>
<B>get_int64_ne b i</B>
is
<B>b</B>
's native-endian 64-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_int64_be </I>
:
<B>bytes -&gt; int -&gt; int64</B>
<P>
<P>
<B>get_int64_be b i</B>
is
<B>b</B>
's big-endian 64-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val get_int64_le </I>
:
<B>bytes -&gt; int -&gt; int64</B>
<P>
<P>
<B>get_int64_le b i</B>
is
<B>b</B>
's little-endian 64-bit integer
starting at byte index
<B>i</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_uint8 </I>
:
<B>bytes -&gt; int -&gt; int -&gt; unit</B>
<P>
<P>
<B>set_uint8 b i v</B>
sets
<B>b</B>
's unsigned 8-bit integer starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_int8 </I>
:
<B>bytes -&gt; int -&gt; int -&gt; unit</B>
<P>
<P>
<B>set_int8 b i v</B>
sets
<B>b</B>
's signed 8-bit integer starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_uint16_ne </I>
:
<B>bytes -&gt; int -&gt; int -&gt; unit</B>
<P>
<P>
<B>set_uint16_ne b i v</B>
sets
<B>b</B>
's native-endian unsigned 16-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_uint16_be </I>
:
<B>bytes -&gt; int -&gt; int -&gt; unit</B>
<P>
<P>
<B>set_uint16_be b i v</B>
sets
<B>b</B>
's big-endian unsigned 16-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_uint16_le </I>
:
<B>bytes -&gt; int -&gt; int -&gt; unit</B>
<P>
<P>
<B>set_uint16_le b i v</B>
sets
<B>b</B>
's little-endian unsigned 16-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_int16_ne </I>
:
<B>bytes -&gt; int -&gt; int -&gt; unit</B>
<P>
<P>
<B>set_int16_ne b i v</B>
sets
<B>b</B>
's native-endian signed 16-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_int16_be </I>
:
<B>bytes -&gt; int -&gt; int -&gt; unit</B>
<P>
<P>
<B>set_int16_be b i v</B>
sets
<B>b</B>
's big-endian signed 16-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_int16_le </I>
:
<B>bytes -&gt; int -&gt; int -&gt; unit</B>
<P>
<P>
<B>set_int16_le b i v</B>
sets
<B>b</B>
's little-endian signed 16-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_int32_ne </I>
:
<B>bytes -&gt; int -&gt; int32 -&gt; unit</B>
<P>
<P>
<B>set_int32_ne b i v</B>
sets
<B>b</B>
's native-endian 32-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_int32_be </I>
:
<B>bytes -&gt; int -&gt; int32 -&gt; unit</B>
<P>
<P>
<B>set_int32_be b i v</B>
sets
<B>b</B>
's big-endian 32-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_int32_le </I>
:
<B>bytes -&gt; int -&gt; int32 -&gt; unit</B>
<P>
<P>
<B>set_int32_le b i v</B>
sets
<B>b</B>
's little-endian 32-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_int64_ne </I>
:
<B>bytes -&gt; int -&gt; int64 -&gt; unit</B>
<P>
<P>
<B>set_int64_ne b i v</B>
sets
<B>b</B>
's native-endian 64-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_int64_be </I>
:
<B>bytes -&gt; int -&gt; int64 -&gt; unit</B>
<P>
<P>
<B>set_int64_be b i v</B>
sets
<B>b</B>
's big-endian 64-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<I>val set_int64_le </I>
:
<B>bytes -&gt; int -&gt; int64 -&gt; unit</B>
<P>
<P>
<B>set_int64_le b i v</B>
sets
<B>b</B>
's little-endian 64-bit integer
starting at byte index
<B>i</B>
to
<B>v</B>
.
<P>
<P>
<B>Since</B>
4.08
<P>
<P>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">Module</A><DD>
<DT id="3"><A HREF="#lbAD">Documentation</A><DD>
<DL>
<DT id="4"><A HREF="#lbAE">Iterators</A><DD>
<DT id="5"><A HREF="#lbAF">Binary encoding/decoding of integers</A><DD>
</DL>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:57 GMT, March 31, 2021
</BODY>
</HTML>