From 9ec6602c9d3c1a8801d996aa3a56c779ce1c5f70 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 11 Jul 2019 16:19:36 +0000 Subject: bits-fmtscan refactor, part one --- src/libstddjb/int64_fmt_generic.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/libstddjb/int64_fmt_generic.c (limited to 'src/libstddjb/int64_fmt_generic.c') diff --git a/src/libstddjb/int64_fmt_generic.c b/src/libstddjb/int64_fmt_generic.c new file mode 100644 index 0000000..f57f915 --- /dev/null +++ b/src/libstddjb/int64_fmt_generic.c @@ -0,0 +1,10 @@ +/* ISC license. */ + +#include + +size_t int64_fmt_generic (char *fmt, int64_t d, uint8_t base) +{ + if (d >= 0) return uint64_fmt_generic(fmt, (uint64_t)d, base) ; + if (fmt) *fmt++ = '-' ; + return 1 + uint64_fmt_generic(fmt, -(uint64_t)d, base) ; +} -- cgit v1.2.3