Fixed issue with scmp in uxnasm
This commit is contained in:
parent
66f898ade4
commit
3da9352230
|
@ -46,7 +46,7 @@ static char ops[][4] = {
|
||||||
"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"
|
"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 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 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 */
|
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;
|
int i;
|
||||||
for(i = 0; i < 0x20; ++i) {
|
for(i = 0; i < 0x20; ++i) {
|
||||||
int m = 0;
|
int m = 0;
|
||||||
char *o = ops[i];
|
if(!scmp(ops[i], s, 3))
|
||||||
if(o[0] != s[0] || o[1] != s[1] || o[2] != s[2])
|
|
||||||
continue;
|
continue;
|
||||||
while(s[3 + m]) {
|
while(s[3 + m]) {
|
||||||
if(s[3 + m] == '2')
|
if(s[3 + m] == '2')
|
||||||
|
|
Loading…
Reference in New Issue