/* This file is part of limb https://lila.oss/limb
* Copyright (C) 2023 Olivier Brunel jjk@jjacky.com */
/* SPDX-License-Identifier: GPL-2.0-only */
#include <string.h>
#include <limb/u64.h>
size_t
u64_0fmt_generic(char *s, u64 u, u8 base, size_t min, const char fill,
u8 grp, const char sep)
{
size_t len = u64_fmt_generic(0, u, base, grp, sep);
if (s) {
if (len < min) {
memset(s, fill, min - len);
s += min - len;
}
u64_fmt_generic(s, u, base, grp, sep);
}
return (len > min) ? len : min;
}