Home | History | Annotate | Line # | Download | only in dev
genpar.c revision 1.3
      1 #define bset(i,b) ((i & (1<<b))?1:0)
      2 
      3 main()
      4 {
      5   int i;
      6 
      7   printf ("u_char even_parity[] = {\n   ");
      8   for (i = 0; i < 0x80; i++)
      9     {
     10       unsigned char par = bset(i,0)+bset(i,1)+bset(i,2)+bset(i,3)+bset(i,4)+
     11       		   bset(i,5)+bset(i,6)+bset(i,7);
     12 
     13       printf ("%2d, ", par & 1);
     14 
     15       if ((i & 15) == 15)
     16         printf ("\n   ");
     17     }
     18   printf ("};\n");
     19 }
     20