home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / snip1292.zip / BITOPS.C < prev    next >
Text File  |  1991-09-06  |  333b  |  14 lines

  1. /*
  2. **  Bit set, clear, and test operations
  3. **
  4. **  public domain snippet by Bob Stout
  5. */
  6.  
  7. typedef enum {ERROR = -1, FALSE, TRUE} LOGICAL;
  8.  
  9. #define BOOL(x) (!(!(x)))
  10.  
  11. #define BitSet(arg,posn) ((arg) | (1L << (posn)))
  12. #define BitClr(arg,posn) ((arg) & ~(1L << (posn)))
  13. #define BitTst(arg,posn) BOOL((arg) & (1L << (posn)))
  14.