|
|
|
@ -10,6 +10,16 @@ size_t scan_ushort(const char* src,unsigned short* dest) {
|
|
|
|
|
/* a good optimizing compiler should remove the else clause when not
|
|
|
|
|
* needed */
|
|
|
|
|
return scan_uint(src,(unsigned int*)dest);
|
|
|
|
|
} if (sizeof(unsigned short) < sizeof(unsigned long)) {
|
|
|
|
|
const char* cur;
|
|
|
|
|
unsigned short l;
|
|
|
|
|
for (cur=src,l=0; *cur>='0' && *cur<='9'; ++cur) {
|
|
|
|
|
unsigned long tmp=l*10ul+*cur-'0';
|
|
|
|
|
if ((unsigned short)tmp != tmp) break;
|
|
|
|
|
l=tmp;
|
|
|
|
|
}
|
|
|
|
|
if (cur>src) *dest=l;
|
|
|
|
|
return (size_t)(cur-src);
|
|
|
|
|
} else {
|
|
|
|
|
register const char *tmp=src;
|
|
|
|
|
register unsigned short int l=0;
|
|
|
|
|