File:  [Net/2] / Net2 / arch / amiga / dev / genpar.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 18:18:14 2018 UTC (8 years, 3 months ago) by root
Branches: NetBSD, MAIN
CVS tags: NetBSD09, HEAD
NetBSD 0.9

#define bset(i,b) ((i & (1<<b))?1:0)

main()
{
  int i;
  
  printf ("u_char even_parity[] = {\n   ");
  for (i = 0; i < 0x80; i++)
    {
      unsigned char par = bset(i,0)+bset(i,1)+bset(i,2)+bset(i,3)+bset(i,4)+
      		   bset(i,5)+bset(i,6)+bset(i,7);

      printf ("%2d, ", par & 1);

      if ((i & 15) == 15)
        printf ("\n   ");
    }
  printf ("};\n");
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.