mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Standardize on just one spelling of BITSPERBYTE.
This commit is contained in:
@ -8,40 +8,34 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/bit.c,v 1.9 2000/01/26 05:56:26 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/bit.c,v 1.10 2000/08/20 19:31:37 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
* utils/memutils.h contains declarations of the functions in this file
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "utils/bit.h"
|
||||
|
||||
|
||||
void
|
||||
BitArraySetBit(BitArray bitArray, BitIndex bitIndex)
|
||||
{
|
||||
bitArray[bitIndex / BitsPerByte]
|
||||
|= (1 << (BitsPerByte - (bitIndex % BitsPerByte) - 1));
|
||||
return;
|
||||
bitArray[bitIndex / BITSPERBYTE] |=
|
||||
(1 << (BITSPERBYTE - 1 - (bitIndex % BITSPERBYTE)));
|
||||
}
|
||||
|
||||
void
|
||||
BitArrayClearBit(BitArray bitArray, BitIndex bitIndex)
|
||||
{
|
||||
bitArray[bitIndex / BitsPerByte]
|
||||
&= ~(1 << (BitsPerByte - (bitIndex % BitsPerByte) - 1));
|
||||
return;
|
||||
bitArray[bitIndex / BITSPERBYTE] &=
|
||||
~(1 << (BITSPERBYTE - 1 - (bitIndex % BITSPERBYTE)));
|
||||
}
|
||||
|
||||
bool
|
||||
BitArrayBitIsSet(BitArray bitArray, BitIndex bitIndex)
|
||||
{
|
||||
return ((bool) (((bitArray[bitIndex / BitsPerByte] &
|
||||
(1 << (BitsPerByte - (bitIndex % BitsPerByte)
|
||||
- 1)
|
||||
)
|
||||
) != 0) ? 1 : 0));
|
||||
return ((bitArray[bitIndex / BITSPERBYTE] &
|
||||
(1 << (BITSPERBYTE - 1 - (bitIndex % BITSPERBYTE)))
|
||||
) != 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user