mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Standardize on just one spelling of BITSPERBYTE.
This commit is contained in:
@ -8,40 +8,34 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 "postgres.h"
|
||||||
|
|
||||||
#include "utils/bit.h"
|
#include "utils/bit.h"
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BitArraySetBit(BitArray bitArray, BitIndex bitIndex)
|
BitArraySetBit(BitArray bitArray, BitIndex bitIndex)
|
||||||
{
|
{
|
||||||
bitArray[bitIndex / BitsPerByte]
|
bitArray[bitIndex / BITSPERBYTE] |=
|
||||||
|= (1 << (BitsPerByte - (bitIndex % BitsPerByte) - 1));
|
(1 << (BITSPERBYTE - 1 - (bitIndex % BITSPERBYTE)));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BitArrayClearBit(BitArray bitArray, BitIndex bitIndex)
|
BitArrayClearBit(BitArray bitArray, BitIndex bitIndex)
|
||||||
{
|
{
|
||||||
bitArray[bitIndex / BitsPerByte]
|
bitArray[bitIndex / BITSPERBYTE] &=
|
||||||
&= ~(1 << (BitsPerByte - (bitIndex % BitsPerByte) - 1));
|
~(1 << (BITSPERBYTE - 1 - (bitIndex % BITSPERBYTE)));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
BitArrayBitIsSet(BitArray bitArray, BitIndex bitIndex)
|
BitArrayBitIsSet(BitArray bitArray, BitIndex bitIndex)
|
||||||
{
|
{
|
||||||
return ((bool) (((bitArray[bitIndex / BitsPerByte] &
|
return ((bitArray[bitIndex / BITSPERBYTE] &
|
||||||
(1 << (BitsPerByte - (bitIndex % BitsPerByte)
|
(1 << (BITSPERBYTE - 1 - (bitIndex % BITSPERBYTE)))
|
||||||
- 1)
|
) != 0);
|
||||||
)
|
|
||||||
) != 0) ? 1 : 0));
|
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: bit.h,v 1.7 2000/01/26 05:58:37 momjian Exp $
|
* $Id: bit.h,v 1.8 2000/08/20 19:31:37 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -17,8 +17,6 @@
|
|||||||
typedef bits8 *BitArray;
|
typedef bits8 *BitArray;
|
||||||
typedef uint32 BitIndex;
|
typedef uint32 BitIndex;
|
||||||
|
|
||||||
#define BitsPerByte 8
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BitArraySetBit
|
* BitArraySetBit
|
||||||
* Sets (to 1) the value of a bit in a bit array.
|
* Sets (to 1) the value of a bit in a bit array.
|
||||||
|
Reference in New Issue
Block a user