Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / u64.h / u64_le.3.md

% limb manual
% u64_le(3)
% limb 0.1.0
% 2023-07-24

# NAME

u64_le, u64_be, u64p_le, u64p_be - convert an u64 to little/big endian

u64pa_le, u64pa_be - convert an array of u64 into little/big endian

# SYNOPSIS

    #include <limb/u64.h>

```pre hl
u64 u64_le(u64 <em>u</em>)
u64 u64_be(u64 <em>u</em>)

void u64p_le(u64 *<em>val</em>)
void u64p_be(u64 *<em>val</em>)

void u64pa_le(u64 *<em>val</em>, size_t <em>len</em>)
void u64pa_be(u64 *<em>val</em>, size_t <em>len</em>)
```

# DESCRIPTION

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

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

The `u64p_le`() and `u64p_be`() macros are similar, only they take a pointer
to an u64 and will convert it into little endian or big endian, respectively.

Finally the `u64pa_le`() and `u64pa_be`() macros are similar to the previous
two, only they take an array of u64 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 `u64_le`() and `u64_be`() have a return value, that of the number `u` read
as a little or big endian number, respectively.