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