|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/lib/Attic/bit.c,v 1.9 2000/01/26 05:56:26 momjian Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/lib/Attic/bit.c,v 1.10 2000/08/20 19:31:37 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
15 | 15 |
|
16 |
| -/* |
17 |
| - * utils/memutils.h contains declarations of the functions in this file |
18 |
| - */ |
19 | 16 | #include"postgres.h"
|
20 | 17 |
|
21 | 18 | #include"utils/bit.h"
|
22 | 19 |
|
| 20 | + |
23 | 21 | void
|
24 | 22 | BitArraySetBit(BitArraybitArray,BitIndexbitIndex)
|
25 | 23 | {
|
26 |
| -bitArray[bitIndex /BitsPerByte] |
27 |
| -|= (1 << (BitsPerByte- (bitIndex %BitsPerByte)-1)); |
28 |
| -return; |
| 24 | +bitArray[bitIndex /BITSPERBYTE] |= |
| 25 | +(1 << (BITSPERBYTE-1- (bitIndex %BITSPERBYTE))); |
29 | 26 | }
|
30 | 27 |
|
31 | 28 | void
|
32 | 29 | BitArrayClearBit(BitArraybitArray,BitIndexbitIndex)
|
33 | 30 | {
|
34 |
| -bitArray[bitIndex /BitsPerByte] |
35 |
| -&= ~(1 << (BitsPerByte- (bitIndex %BitsPerByte)-1)); |
36 |
| -return; |
| 31 | +bitArray[bitIndex /BITSPERBYTE] &= |
| 32 | +~(1 << (BITSPERBYTE-1- (bitIndex %BITSPERBYTE))); |
37 | 33 | }
|
38 | 34 |
|
39 | 35 | bool
|
40 | 36 | BitArrayBitIsSet(BitArraybitArray,BitIndexbitIndex)
|
41 | 37 | {
|
42 |
| -return ((bool) (((bitArray[bitIndex /BitsPerByte]& |
43 |
| - (1 << (BitsPerByte- (bitIndex %BitsPerByte) |
44 |
| --1) |
45 |
| - ) |
46 |
| - )!=0) ?1 :0)); |
| 38 | +return ((bitArray[bitIndex /BITSPERBYTE]& |
| 39 | + (1 << (BITSPERBYTE-1- (bitIndex %BITSPERBYTE))) |
| 40 | +)!=0); |
47 | 41 | }
|