1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +03:00

Postgres95 1.01 Distribution - Virgin Sources

This commit is contained in:
Marc G. Fournier
1996-07-09 06:22:35 +00:00
commit d31084e9d1
868 changed files with 242656 additions and 0 deletions

45
src/backend/lib/bit.c Normal file
View File

@@ -0,0 +1,45 @@
/*-------------------------------------------------------------------------
*
* bit.c--
* Standard bit array code.
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/lib/Attic/bit.c,v 1.1.1.1 1996/07/09 06:21:28 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
/*
* utils/memutils.h contains declarations of the functions in this file
*/
#include "utils/memutils.h"
void
BitArraySetBit(BitArray bitArray, BitIndex bitIndex)
{
bitArray[bitIndex/BitsPerByte]
|= (1 << (BitsPerByte - (bitIndex % BitsPerByte) - 1));
return;
}
void
BitArrayClearBit(BitArray bitArray, BitIndex bitIndex)
{
bitArray[bitIndex/BitsPerByte]
&= ~(1 << (BitsPerByte - (bitIndex % BitsPerByte) - 1));
return;
}
bool
BitArrayBitIsSet(BitArray bitArray, BitIndex bitIndex)
{
return( (bool) (((bitArray[bitIndex / BitsPerByte] &
(1 << (BitsPerByte - (bitIndex % BitsPerByte)
- 1)
)
) != 0 ) ? 1 : 0) );
}