Welcome to little lamb

Code » limb » release » tree

[release] / src / doc / u64.h / u64_pack.3.md

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

# NAME

u64_pack, u64_unpack, u64_pack_big, u64_unpack_big - store/read an u64 into/from
a byte array

# SYNOPSIS

    #include <limb/u64.h>

```pre hl
void u64_pack(void *<em>dst</em>, u64 <em>val</em>)
void u64_unpack(u64 *<em>val</em>, const void *<em>sce</em>)

void u64_pack_big(void *<em>dst</em>, u64 <em>val</em>)
void u64_unpack_big(u64 *<em>val</em>, const void *<em>sce</em>)
```

# DESCRIPTION

All of these aim to either store the given number `val` into the specified
byte array `dst`, or read a number from the specified byte array `sce` and set
the value pointed by `val` to its value.

The `u64_pack`() function stores the number `val` into the 8 bytes pointed by
`dst`, encoded as little endian.

The `u64_unpack`() function reads 8 bytes pointed by `sce` as little endian
encoded number, setting the value pointed by `val` to its value.

The `u64_pack_big`() function is similar to `u64_pack`() only as big endian.

The `u64_unpack_big`() function is similar to `u64_unpack`() only as big endian.

# SEE ALSO

[u64_pack_trim](3)