Skip to content

Commit d594eec

Browse files
committed
Standardize on just one spelling of BITSPERBYTE.
1 parent 81ddc46 commit d594eec

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

src/backend/lib/bit.c

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,34 @@
88
*
99
*
1010
* 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 $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515

16-
/*
17-
* utils/memutils.h contains declarations of the functions in this file
18-
*/
1916
#include "postgres.h"
2017

2118
#include "utils/bit.h"
2219

20+
2321
void
2422
BitArraySetBit(BitArray bitArray, BitIndex bitIndex)
2523
{
26-
bitArray[bitIndex / BitsPerByte]
27-
|= (1 << (BitsPerByte - (bitIndex % BitsPerByte) - 1));
28-
return;
24+
bitArray[bitIndex / BITSPERBYTE] |=
25+
(1 << (BITSPERBYTE - 1 - (bitIndex % BITSPERBYTE)));
2926
}
3027

3128
void
3229
BitArrayClearBit(BitArray bitArray, BitIndex bitIndex)
3330
{
34-
bitArray[bitIndex / BitsPerByte]
35-
&= ~(1 << (BitsPerByte - (bitIndex % BitsPerByte) - 1));
36-
return;
31+
bitArray[bitIndex / BITSPERBYTE] &=
32+
~(1 << (BITSPERBYTE - 1 - (bitIndex % BITSPERBYTE)));
3733
}
3834

3935
bool
4036
BitArrayBitIsSet(BitArray bitArray, BitIndex bitIndex)
4137
{
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);
4741
}

src/include/utils/bit.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: bit.h,v 1.7 2000/01/26 05:58:37 momjian Exp $
10+
* $Id: bit.h,v 1.8 2000/08/20 19:31:37 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -17,8 +17,6 @@
1717
typedef bits8 *BitArray;
1818
typedef uint32 BitIndex;
1919

20-
#define BitsPerByte 8
21-
2220
/*
2321
* BitArraySetBit
2422
* Sets (to 1) the value of a bit in a bit array.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy