![leitner](/assets/img/avatar_default.png)
write generic stralloc and array textcode wrapper functions change textcode API to use long instead of int add cescape fmt and scan functions to textcode add fmt_foldwhitespace to textcode
13 lines
213 B
C
13 lines
213 B
C
#include "scan.h"
|
|
|
|
int scan_fromhex(unsigned char c) {
|
|
if (c>='0' && c<='9')
|
|
return c-'0';
|
|
else if (c>='A' && c<='F')
|
|
return c-'A'+10;
|
|
else if (c>='a' && c<='f')
|
|
return c-'a'+10;
|
|
return -1;
|
|
}
|
|
|