Fixed issue with scmp in uxnasm

This commit is contained in:
neauoire 2021-08-29 11:43:00 -07:00
parent 66f898ade4
commit 3da9352230
1 changed files with 2 additions and 3 deletions

View File

@ -46,7 +46,7 @@ static char ops[][4] = {
"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"
};
static int scmp(char *a, char *b, int len) { int i = 0; while(a[i] == b[i] && i < len) if(!a[i++]) return 1; return 0; } /* string compare */
static int scmp(char *a, char *b, int len) { int i = 0; while(a[i] == b[i]) if(!a[i] || ++i >= len) return 1; return 0; } /* string compare */
static int sihx(char *s) { int i = 0; char c; while((c = s[i++])) if(!(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'f')) return 0; return i > 1; } /* string is hexadecimal */
static int shex(char *s) { int n = 0, i = 0; char c; while((c = s[i++])) if(c >= '0' && c <= '9') n = n * 16 + (c - '0'); else if(c >= 'a' && c <= 'f') n = n * 16 + 10 + (c - 'a'); return n; } /* string to num */
static int slen(char *s) { int i = 0; while(s[i] && s[++i]) ; return i; } /* string length */
@ -85,8 +85,7 @@ findopcode(char *s)
int i;
for(i = 0; i < 0x20; ++i) {
int m = 0;
char *o = ops[i];
if(o[0] != s[0] || o[1] != s[1] || o[2] != s[2])
if(!scmp(ops[i], s, 3))
continue;
while(s[3 + m]) {
if(s[3 + m] == '2')