Welcome to little lamb

Code » limb » release » tree

[release] / src / doc / u16.h / u16.h.0.md

% limb manual
% u16.h(0)
% limb 0.1.0
% 2023-07-24

# NAME

u16.h - 16bit unsigned integers

# SYNOPSIS

    #include <limb/u16.h>

# DESCRIPTION

This header defines functions allowing to work with 16bit unsigned integers.

## Constants

The following constants are defined :

: *U16_FMT*
:: Maximum length for a byte array that can hold an u16 value in decimal
:: representation, plus a NUL-terminating byte

: *U16_FMTG*
:: Same as *U16_FMT* but with thousand-separators

: *U16_BFMT*
:: Same as *U16_FMT* but for binary

: *U16_OFMT*
:: Same as *U16_FMT* but for octal

: *U16_XFMT*
:: Same as *U16_FMT* but for hexadecimal

## Functions

The following functions/macros are defined :

: [u16_be](3)
:: Convert a u16 number to big endian.

: [u16_le](3)
:: Convert a u16 number to little endian.

: [u16p_be](3)
:: Similar to [u16_be](3) but takes a pointer.

: [u16p_le](3)
:: Similar to [u16_le](3) but takes a pointer.

: [u16pa_be](3)
:: Similar to [u16p_be](3) but for an array of pointers.

: [u16pa_le](3)
:: Similar to [u16p_le](3) but for an array of pointers.

: [u16_pack](3)
:: Store a u16 number encoded in little endian.

: [u16_unpack](3)
:: Read a u16 number encoded in little endian.

: [u16_pack_big](3)
:: Store a u16 number encoded in big endian.

: [u16_unpack_big](3)
:: Read a u16 number encoded in big endian.

: [u16_fmt](3)
:: Write a u16 number as decimal into a byte array.

: [u16_fmtg](3)
:: Write a u16 number as decimal, using coma as thousand separator, into a
:: byte array.

: [u16_bfmt](3)
:: Similar to [u16_fmt](3) but as binary.

: [u16_ofmt](3)
:: Similar to [u16_fmt](3) but as octal.

: [u16_xfmt](3)
:: Similar to [u16_fmt](3) but as hexadecimal.

: [u16_0fmt](3)
:: Similar to [u16_fmt](3) but filling with zeroes if less than given size.

: [u16_0fmtg](3)
:: Similar to [u16_fmtg](3) but filling with zeroes if less than given size.

: [u16_0bfmt](3)
:: Similar to [u16_bfmt](3) but filling with zeroes if less than given size.

: [u16_0ofmt](3)
:: Similar to [u16_ofmt](3) but filling with zeroes if less than given size.

: [u16_0xfmt](3)
:: Similar to [u16_xfmt](3) but filling with zeroes if less than given size.

: [u16_scan](3)
:: Read a u16 value from a byte array.

: [u16_bscan](3)
:: Similar to [u16_scan](3) but for binary value.

: [u16_oscan](3)
:: Similar to [u16_scan](3) but for octal value.

: [u16_xscan](3)
:: Similar to [u16_scan](3) but for hexadecimal value.

: [u16_scan0](3)
:: Similar to [u16_scan](3) but expects a NUL-terminated string.

: [u16_bscan0](3)
:: Similar to [u16_bscan](3) but expects a NUL-terminated string.

: [u16_oscan0](3)
:: Similar to [u16_oscan](3) but expects a NUL-terminated string.

: [u16_xscan0](3)
:: Similar to [u16_xscan](3) but expects a NUL-terminated string.