limb 0.2.0

2024-01-09

u64_fmt_generic(3)
limb manual
u64_fmt_generic(3)

NAME

u64_fmt_generic, u64_0fmt_generic - write an u64 number into a byte array

SYNOPSIS

#include <limb/u64.h>
size_t u64_fmt_generic(char *s, u64 u, u8 base, u8 grp, const char sep)
size_t u64_0fmt_generic(char *s, u64 u, u8 base, size_t min, const char fill,
                        u8 grp, const char sep)

DESCRIPTION

The u64_fmt_generic() function will put into s the value of u encoded in base base. If grp is not zero, sep will be used as separator every grp characters, starting from the end.

The u64_0fmt_generic() function is similar, only if the size needed is less than min it will fill it up by prefixing it using as many instances of fill as needed.

It is possible to use NULL as s to only have length computation performed.

Macros

Note that many macros are available for ease of use, such as u64_fmt(3), u32_fmt(3) or u16_fmt(3) and their related macros.

RETURN VALUE

Both functions return the length of the string written into s, or required to do so when s is NULL

limb 0.1.0
2023-07-24
u64_fmt_generic(3)