scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

0057-duff.c (542B)


      1 int main()
      2 {
      3 	int  count, n;
      4 	char *from, *to;
      5 	char a[39], b[39];
      6 
      7 	for(n = 0; n < 39; n++) {
      8 		a[n] = n;
      9 		b[n] = 0;
     10 	}
     11 	from = a;
     12 	to = b;
     13 	count = 39;
     14 	n = (count + 7) / 8;
     15 	switch (count % 8) {
     16 	case 0: do { *to++ = *from++;
     17 	case 7:      *to++ = *from++;
     18 	case 6:      *to++ = *from++;
     19 	case 5:      *to++ = *from++;
     20 	case 4:      *to++ = *from++;
     21 	case 3:      *to++ = *from++;
     22 	case 2:      *to++ = *from++;
     23 	case 1:      *to++ = *from++;
     24 			} while (--n > 0);
     25 	}
     26 	for(n = 0; n < 39; n++)
     27 		if(a[n] != b[n])
     28 			return 1;
     29 	return 0;
     30 }