1: #ifndef lint
   2: static char *mktable_c = "$Header: mktable.c,v 10.5 86/02/01 15:44:59 tony Rel $";
   3: #endif 	lint
   4: 
   5: #include <stdio.h>
   6: 
   7: char reverse_byte[0x100] = { 0 };
   8: 
   9: main()
  10: {
  11:     seed_table();
  12:     fill_in_table();
  13:     print_table();
  14: }
  15: 
  16: seed_table()
  17: {
  18:     int i = 0;
  19:     int j = 0x100/2;
  20:     int b = 0;
  21: 
  22:     for (;;) {
  23:         reverse_byte[i] = b;
  24:         if (j == 0)
  25:             break;
  26:         i = 2*i + 1;
  27:         b = b + j;
  28:         j = j/2;
  29:     }
  30: }
  31: 
  32: fill_in_table()
  33: {
  34:     int b;
  35: 
  36:     for (b = 1; b < 0x100-2; b += 1)
  37:         reverse_byte[b+1] =
  38:             reverse_byte[b] ^ reverse_byte[b^(b+1)];
  39: }
  40: 
  41: print_table()
  42: {
  43:     int b;
  44: 
  45:     printf("char reverse_byte[0x100] = {\n\t");
  46:     b = 0;
  47:     for (;;) {
  48:         printf("0x%02x", reverse_byte[b] & 0xff);
  49:         b += 1;
  50:         if (b == 0x100) {
  51:             printf("\n};\n");
  52:             return;
  53:         } else if (b % 8 == 0) {
  54:             printf(",\n\t");
  55:         } else {
  56:             printf(", ");
  57:         }
  58:     }
  59: }

Defined functions

fill_in_table defined in line 32; used 1 times
  • in line 12
main defined in line 9; never used
print_table defined in line 41; used 1 times
  • in line 13
seed_table defined in line 16; used 1 times
  • in line 11

Defined variables

mktable_c defined in line 2; never used
reverse_byte defined in line 7; used 6 times
Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 943
Valid CSS Valid XHTML 1.0 Strict