Replaced ari for loop with while
This commit is contained in:
parent
c619581739
commit
4078919811
24
src/modal.c
24
src/modal.c
|
@ -50,18 +50,18 @@ device_write(char *s)
|
|||
int acc = sint(*reg++);
|
||||
/* clang-format off */
|
||||
switch(c) {
|
||||
case '+': for(;*reg != 0; reg++) acc += sint(*reg); break;
|
||||
case '-': for(;*reg != 0; reg++) acc -= sint(*reg); break;
|
||||
case '*': for(;*reg != 0; reg++) acc *= sint(*reg); break;
|
||||
case '/': for(;*reg != 0; reg++) acc /= sint(*reg); break;
|
||||
case '%': for(;*reg != 0; reg++) acc %= sint(*reg); break;
|
||||
case '&': for(;*reg != 0; reg++) acc &= sint(*reg); break;
|
||||
case '^': for(;*reg != 0; reg++) acc ^= sint(*reg); break;
|
||||
case '|': for(;*reg != 0; reg++) acc |= sint(*reg); break;
|
||||
case '=': for(;*reg != 0; reg++) acc = acc == sint(*reg); break;
|
||||
case '!': for(;*reg != 0; reg++) acc = acc != sint(*reg); break;
|
||||
case '>': for(;*reg != 0; reg++) acc = acc > sint(*reg); break;
|
||||
case '<': for(;*reg != 0; reg++) acc = acc < sint(*reg); break;
|
||||
case '+': while(*reg) acc += sint(*reg++); break;
|
||||
case '-': while(*reg) acc -= sint(*reg++); break;
|
||||
case '*': while(*reg) acc *= sint(*reg++); break;
|
||||
case '/': while(*reg) acc /= sint(*reg++); break;
|
||||
case '%': while(*reg) acc %= sint(*reg++); break;
|
||||
case '&': while(*reg) acc &= sint(*reg++); break;
|
||||
case '^': while(*reg) acc ^= sint(*reg++); break;
|
||||
case '|': while(*reg) acc |= sint(*reg++); break;
|
||||
case '=': while(*reg) acc = acc == sint(*reg++); break;
|
||||
case '!': while(*reg) acc = acc != sint(*reg++); break;
|
||||
case '>': while(*reg) acc = acc > sint(*reg++); break;
|
||||
case '<': while(*reg) acc = acc < sint(*reg++); break;
|
||||
}
|
||||
/* clang-format on */
|
||||
dst_ += snprintf(dst_, 0x10, "%d", acc);
|
||||
|
|
Loading…
Reference in New Issue