limb 0.2.0

2024-01-09

u32_le(3)
limb manual
u32_le(3)

NAME

u32_le, u32_be, u32p_le, u32p_be - convert an u32 to little/big endian

u32pa_le, u32pa_be - convert an array of u32 into little/big endian

SYNOPSIS

#include <limb/u32.h>
u32 u32_le(u32 u)
u32 u32_be(u32 u)

void u32p_le(u32 *val)
void u32p_be(u32 *val)

void u32pa_le(u32 *val, size_t len)
void u32pa_be(u32 *val, size_t len)

DESCRIPTION

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

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

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

Finally the u32pa_le() and u32pa_be() macros are similar to the previous two, only they take an array of u32 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 u32_le() and u32_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
u32_le(3)