home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / libg++-2.7.1-bin.lha / lib / g++-include / bitdo1.h < prev    next >
C/C++ Source or Header  |  1996-10-12  |  695b  |  33 lines

  1. #ifndef ONES
  2. #define ONES  ((_BS_word)(~0L))
  3. #endif
  4.   register int nwords;
  5.   register _BS_word mask;
  6.   if (offset == 0)
  7.     ;
  8.   else if (offset + length >= _BS_BITS_PER_WORD)
  9.     {
  10.       mask = ONES _BS_RIGHT offset;
  11.       DOIT(*ptr++, mask);
  12.       length -= _BS_BITS_PER_WORD - offset;
  13.     }
  14.   else
  15.     {
  16.       mask = (ONES _BS_RIGHT (_BS_BITS_PER_WORD - length))
  17.     _BS_LEFT (_BS_BITS_PER_WORD - length - offset);
  18.       DOIT(*ptr, mask);
  19.       goto done;
  20.     }
  21.   nwords = _BS_INDEX(length);
  22.   while (--nwords >= 0)
  23.    {
  24.      DOIT(*ptr++, ONES);
  25.    }
  26.   length = _BS_POS (length);
  27.   if (length)
  28.     {
  29.       mask = ONES _BS_LEFT (_BS_BITS_PER_WORD - length);
  30.       DOIT(*ptr, mask);
  31.     }
  32.  done: ;
  33.