// Test code for intcounts.S, slightly modified from intcount.c, q.v. #include #include enum { nb = 1024 }; extern int kj[nb], vj[nb]; void inc(unsigned k); // in intcounts.S int main() { int xs[] = {1023, 2047, 2344, 102, 2344, 7, 102, 5, 67, 1, 1025, 17, 2049, 1025, 2344}; for (int i = 0; i < sizeof(xs)/sizeof(xs[0]); i++) inc(xs[i]); for (int i = 0; i < nb; i++) { if (kj[i]) printf("%d: %d\n", kj[i], vj[i]); } // to fail: for (int i = 0; i < nb; i++) inc(i+1); return 0; }