skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

int32_scan.c (299B)


      1 /* ISC license. */
      2 
      3 #include <skalibs/uint32.h>
      4 #include <skalibs/uint64.h>
      5 #include "fmtscan-internal.h"
      6 
      7 size_t int32_scan_base (char const *s, int32_t *d, uint8_t base)
      8 {
      9   int64_t dd ;
     10   size_t pos = int64_scan_base_max(s, &dd, base, UINT32_MAX) ;
     11   if (pos) *d = (int32_t)dd ;
     12   return pos ;
     13 }