summaryrefslogtreecommitdiff
path: root/src/libstddjb/uint16_scan.c
blob: 4b23e64ab657130b9a62acedd7b978d3a4a7adae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* ISC license. */

#include <skalibs/uint16.h>
#include <skalibs/uint64.h>
#include "fmtscan-internal.h"

size_t uint16_scan_base (char const *s, uint16_t *u, uint8_t base)
{
  uint64_t uu ;
  size_t pos = uint64_scan_base_max(s, &uu, base, UINT16_MAX) ;
  if (pos) *u = (uint16_t)uu ;
  return pos ;
}