home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 161_01 / 405.c < prev    next >
Text File  |  1985-08-29  |  322b  |  19 lines

  1.  
  2. /*
  3.  *    return the bit sum of a byte argument
  4.  *    version 6
  5.  */
  6.  
  7. # include "timer1.h"
  8. # define bitcnt(x) (bitsum[(x) & BYTEMASK])
  9. # define BYTEMASK 0377
  10.  
  11. char c = 15;
  12.  
  13. static char bitsum[256] = {
  14.     '\1', '\0', '\1', '\1', '\2', '\1', '\0', '\1', '\1', '\2', '\1'
  15. };
  16.  
  17. DO_IEXPR("Bit count V6") bitcnt(c)    OD
  18. }
  19.