(readability) Use preincrements throughout in void context.

This commit is contained in:
Andrew Alderwick 2021-12-14 23:16:27 +00:00
parent 96c11198da
commit 2330320985
4 changed files with 8 additions and 8 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}