Use macro for chex

This commit is contained in:
Devine Lu Linvega 2024-05-13 14:37:21 -07:00
parent f7a2b49120
commit f88bb1f137
1 changed files with 3 additions and 12 deletions

View File

@ -13,6 +13,7 @@ static char bank_b[0x4000], *dst_ = bank_b;
static char *regs[0x100], stack[0x10], *stack_ = stack; static char *regs[0x100], stack[0x10], *stack_ = stack;
#define spacer(c) (c <= ' ' || c == '(' || c == ')') #define spacer(c) (c <= ' ' || c == '(' || c == ')')
#define chex(c) (0xf & (c - (c <= '9' ? '0' : 0x57)))
static char * static char *
copy(char *src, char *dst, int length) copy(char *src, char *dst, int length)
@ -21,16 +22,6 @@ copy(char *src, char *dst, int length)
return dst; return dst;
} }
int
chex(char c)
{
c -= 0x30;
if(c < 10) return c;
c -= 0x31;
if(c < 6) return 10 + c;
return 0;
}
static char * static char *
walk(char *s) walk(char *s)
{ {