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

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

size_t int32_scan_base (char const *s, int32_t *d, uint8_t base)
{
  int64_t dd ;
  size_t pos = int64_scan_base_max(s, &dd, base, UINT32_MAX) ;
  if (pos) *d = (int32_t)dd ;
  return pos ;
}