summaryrefslogtreecommitdiff
path: root/src/libstddjb/int16_scan.c
blob: a8e7e55a7fca45278dd84f95390834145578d808 (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 int16_scan_base (char const *s, int16_t *d, uint8_t base)
{
  int64_t dd ;
  size_t pos = int64_scan_base_max(s, &dd, base, UINT16_MAX) ;
  if (pos) *d = (uint16_t)dd ;
  return pos ;
}