commit 23303209858b8dc6500cfdb04f20411bd6ee4666
parent 96c11198da93eecf58c414e7e463d4501e4997d5
Author: Andrew Alderwick <andrew@alderwick.co.uk>
Date: Tue, 14 Dec 2021 23:16:27 +0000
(readability) Use preincrements throughout in void context.
Diffstat:
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/devices/ppu.c b/src/devices/ppu.c
@@ -83,8 +83,8 @@ void
ppu_1bpp(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy)
{
Uint16 v, h;
- for(v = 0; v < 8; v++)
- for(h = 0; h < 8; h++) {
+ for(v = 0; v < 8; ++v)
+ for(h = 0; h < 8; ++h) {
Uint8 ch1 = (sprite[v] >> (7 - h)) & 0x1;
if(ch1 || blending[4][color])
ppu_write(p,
@@ -99,8 +99,8 @@ void
ppu_2bpp(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint8 flipx, Uint8 flipy)
{
Uint16 v, h;
- for(v = 0; v < 8; v++)
- for(h = 0; h < 8; h++) {
+ for(v = 0; v < 8; ++v)
+ for(h = 0; h < 8; ++h) {
Uint8 ch1 = ((sprite[v] >> (7 - h)) & 0x1);
Uint8 ch2 = ((sprite[v + 8] >> (7 - h)) & 0x1);
Uint8 ch = ch1 + ch2 * 2;
diff --git a/src/uxn-fast.c b/src/uxn-fast.c
@@ -4022,7 +4022,7 @@ uxn_boot(Uxn *u)
{
unsigned int i;
char *cptr = (char *)u;
- for(i = 0; i < sizeof(*u); i++)
+ for(i = 0; i < sizeof(*u); ++i)
cptr[i] = 0x00;
return 1;
}
diff --git a/src/uxn.c b/src/uxn.c
@@ -140,7 +140,7 @@ uxn_boot(Uxn *u)
{
unsigned int i;
char *cptr = (char *)u;
- for(i = 0; i < sizeof(*u); i++)
+ for(i = 0; i < sizeof(*u); ++i)
cptr[i] = 0x00;
return 1;
}
diff --git a/src/uxnasm.c b/src/uxnasm.c
@@ -58,7 +58,7 @@ static int scmp(char *a, char *b, int len) { int i = 0; while(a[i] == b[i]) if
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]) ++i; return i; } /* string length */
-static char *scpy(char *src, char *dst, int len) { int i = 0; while((dst[i] = src[i]) && i < len - 2) i++; dst[i + 1] = '\0'; return dst; } /* string copy */
+static char *scpy(char *src, char *dst, int len) { int i = 0; while((dst[i] = src[i]) && i < len - 2) ++i; dst[i + 1] = '\0'; return dst; } /* string copy */
static char *scat(char *dst, const char *src) { char *ptr = dst + slen(dst); while(*src) *ptr++ = *src++; *ptr = '\0'; return dst; } /* string cat */
/* clang-format on */
@@ -116,7 +116,7 @@ findopcode(char *s)
i |= (1 << 7); /* mode: keep */
else
return 0; /* failed to match */
- m++;
+ ++m;
}
return i;
}