Kagamin:
> this is incorrect

Thank you for spotting the silly bug, I'll fix it now. (It seems it's more easy 
to leave bugs in such kind of code because it does nothing useful).

But note that in both programs:
#define FIRST
static if (1) {
So the first part only is run in both D and C code, not the wrong one...

So the code is like this:

#include "stdio.h"

int main() {
    int counter0 = 0, counter1 = 0, counter2 = 0, counter3 = 0;
    int i = 300000000;
    while (i--) {
        // 0.63 s
        if (i % 4 == 0) {
            counter0++;
        } else if (i % 4 == 1) {
            counter1++;
        } else if (i % 4 == 2) {
            counter2++;
        } else {
            counter3++;
        }
    }

    printf("%d %d %d %d\n", counter0, counter1, counter2, counter3);
    return 0;
}

So the problem and timings of the first part I have shown are correct still :-)

Bye,
bearophile

Reply via email to