uxn

Varvara Ordinator, written in ANSI C(SDL2)
git clone https://git.eamoncaddigan.net/uxn.git
Log | Files | Refs | README | LICENSE

commit 3da9352230159f1032c375bb1c88d35ccb2bc491
parent 66f898ade4cde8c821ca39af3c7a4a5182906d0f
Author: neauoire <aliceffekt@gmail.com>
Date:   Sun, 29 Aug 2021 11:43:00 -0700

Fixed issue with scmp in uxnasm

Diffstat:
Msrc/uxnasm.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/uxnasm.c b/src/uxnasm.c @@ -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')