limb 0.2.0

2024-01-09

u16_le(3)
limb manual
u16_le(3)

NAME

u16_le, u16_be, u16p_le, u16p_be - convert an u16 to little/big endian

u16pa_le, u16pa_be - convert an array of u16 into little/big endian

SYNOPSIS

#include <limb/u16.h>
u16 u16_le(u16 u)
u16 u16_be(u16 u)

void u16p_le(u16 *val)
void u16p_be(u16 *val)

void u16pa_le(u16 *val, size_t len)
void u16pa_be(u16 *val, size_t len)

DESCRIPTION

All of these aim to ensure a value or variable is in expected endianness.

The u16_le() and u16_be() macros will return the value after having read the given number u as a little endian or big endian value, respectively.

The u16p_le() and u16p_be() macros are similar, only they take a pointer to an u16 and will convert it into little endian or big endian, respectively.

Finally the u16pa_le() and u16pa_be() macros are similar to the previous two, only they take an array of u16 of size len and convert every element.

Note

Note that these are macros they may be either no-op or byte swapping functions depending on the endianness of the host.

RETURN VALUE

Only u16_le() and u16_be() have a return value, that of the number u read as a little or big endian number, respectively.

limb 0.1.0
2023-07-24
u16_le(3)