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/uint32_scan.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/libstddjb/uint32_scan.c') diff --git a/src/libstddjb/uint32_scan.c b/src/libstddjb/uint32_scan.c index 58d43e6..672beec 100644 --- a/src/libstddjb/uint32_scan.c +++ b/src/libstddjb/uint32_scan.c @@ -1,6 +1,13 @@ /* ISC license. */ -#include "fmtscan-internal.h" #include +#include +#include "fmtscan-internal.h" -SCANB(32) +size_t uint32_scan_base (char const *s, uint32_t *u, uint8_t base) +{ + uint64_t uu ; + size_t pos = uint64_scan_base_max(s, &uu, base, UINT32_MAX) ; + if (pos) *u = (uint32_t)uu ; + return pos ; +} -- cgit v1.2.3