int16_scan.c (300B)
1 /* ISC license. */ 2 3 #include <skalibs/uint16.h> 4 #include <skalibs/uint64.h> 5 #include "fmtscan-internal.h" 6 7 size_t int16_scan_base (char const *s, int16_t *d, uint8_t base) 8 { 9 int64_t dd ; 10 size_t pos = int64_scan_base_max(s, &dd, base, UINT16_MAX) ; 11 if (pos) *d = (uint16_t)dd ; 12 return pos ; 13 }