1: /*
   2:  *	$Source: /u1/X/hacks/bitrot/RCS/twiddle.h,v $
   3:  *	$Author: tony $
   4:  *	$Locker:  $
   5:  *	$Header: twiddle.h,v 10.1 86/02/01 15:43:23 tony Rel $
   6:  */
   7: 
   8: #include <sys/types.h>
   9: 
  10: /* WARNING!  ASSUMES 8-BIT CHARACTERS! */
  11: 
  12: /* Each of these operates on the xth bit from map */
  13: /* Map must be a pointer, not necessarily a u_char pointer */
  14: #define fetch(map, x) (1 & (((u_char *) map)[x >> 3] >> (x & 7)))
  15: #define set(map, x) ((((u_char *) map)[x>>3] |= 1 << (x & 7)))
  16: #define reset(map, x) ((((u_char *) map)[x>>3] &= ~(1 << (x & 7))))
  17: #define flip(map,x) ((((u_char *) map)[x>>3] ^=  1 << (x & 7)))
  18: #define place(map, x, bit) ((bit ? set(map,x),0 : reset(map,x), 0))

Defined macros

fetch defined in line 14; used 4 times
flip defined in line 17; never used
place defined in line 18; never used
reset defined in line 16; used 2 times
set defined in line 15; used 2 times

Usage of this include

Last modified: 1986-02-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 856
Valid CSS Valid XHTML 1.0 Strict