diff --git a/firmware/irq.c b/firmware/irq.c index 2dff1b0..e67b16d 100644 --- a/firmware/irq.c +++ b/firmware/irq.c @@ -30,7 +30,6 @@ uint32_t *irq(uint32_t *regs, uint32_t irqs) if ((irqs & 6) != 0) { - int i, k; uint32_t pc = regs[0] - 4; uint32_t instr = *(uint32_t*)pc; @@ -59,8 +58,8 @@ uint32_t *irq(uint32_t *regs, uint32_t irqs) print_str("\n"); } - for (i = 0; i < 8; i++) - for (k = 0; k < 4; k++) + for (int i = 0; i < 8; i++) + for (int k = 0; k < 4; k++) { int r = i + k*8; diff --git a/firmware/multest.c b/firmware/multest.c index c6323ec..37ecf32 100644 --- a/firmware/multest.c +++ b/firmware/multest.c @@ -17,8 +17,7 @@ static uint32_t xorshift32(void) { void multest(void) { - int i; - for (i = 0; i < 10; i++) + for (int i = 0; i < 10; i++) { uint32_t a = xorshift32(); uint32_t b = xorshift32(); diff --git a/firmware/print.c b/firmware/print.c index da0dd63..a3000f5 100644 --- a/firmware/print.c +++ b/firmware/print.c @@ -35,8 +35,7 @@ void print_dec(unsigned int val) void print_hex(unsigned int val) { - int i; - for (i = 32-4; i >= 0; i -= 4) + for (int i = 32-4; i >= 0; i -= 4) *((volatile uint32_t*)OUTPORT) = "0123456789ABCDEF"[(val >> i) % 16]; } diff --git a/firmware/sieve.c b/firmware/sieve.c index 20a45d8..f3350c6 100644 --- a/firmware/sieve.c +++ b/firmware/sieve.c @@ -54,18 +54,17 @@ static void print_prime(int idx, int val) void sieve(void) { - int i, j, k; int idx = 1; hash = 5381; print_prime(idx++, 2); - for (i = 0; i < BITMAP_SIZE; i++) { + for (int i = 0; i < BITMAP_SIZE; i++) { if (bitmap_get(i)) continue; print_prime(idx++, 3+2*i); - for (j = 2*(3+2*i);; j += 3+2*i) { + for (int j = 2*(3+2*i);; j += 3+2*i) { if (j%2 == 0) continue; - k = (j-3)/2; + int k = (j-3)/2; if (k >= BITMAP_SIZE) break; bitmap_set(k);