All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
bitvec.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  ** Filename: bitvec.c
3  ** Purpose: Routines for manipulating bit vectors
4  ** Author: Dan Johnson
5  ** History: Thu Mar 15 10:37:27 1990, DSJ, Created.
6  **
7  ** (c) Copyright Hewlett-Packard Company, 1988.
8  ** Licensed under the Apache License, Version 2.0 (the "License");
9  ** you may not use this file except in compliance with the License.
10  ** You may obtain a copy of the License at
11  ** http://www.apache.org/licenses/LICENSE-2.0
12  ** Unless required by applicable law or agreed to in writing, software
13  ** distributed under the License is distributed on an "AS IS" BASIS,
14  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  ** See the License for the specific language governing permissions and
16  ** limitations under the License.
17  ******************************************************************************/
18 
19 /*-----------------------------------------------------------------------------
20  Include Files and Type Defines
21 -----------------------------------------------------------------------------*/
22 #include "bitvec.h"
23 
24 #include <stdio.h>
25 
26 #include "emalloc.h"
27 #include "freelist.h"
28 #include "tprintf.h"
29 
30 /*-----------------------------------------------------------------------------
31  Public Code
32 -----------------------------------------------------------------------------*/
33 /*---------------------------------------------------------------------------*/
48 BIT_VECTOR ExpandBitVector(BIT_VECTOR Vector, int NewNumBits) {
49  return ((BIT_VECTOR) Erealloc(Vector,
50  sizeof(Vector[0]) * WordsInVectorOfSize(NewNumBits)));
51 } /* ExpandBitVector */
52 
53 
54 /*---------------------------------------------------------------------------*/
55 void FreeBitVector(BIT_VECTOR BitVector) {
70  if (BitVector) {
71  Efree(BitVector);
72  }
73 } /* FreeBitVector */
74 
75 
76 /*---------------------------------------------------------------------------*/
90 BIT_VECTOR NewBitVector(int NumBits) {
91  return ((BIT_VECTOR) Emalloc(sizeof(uinT32) *
92  WordsInVectorOfSize(NumBits)));
93 } /* NewBitVector */
void FreeBitVector(BIT_VECTOR BitVector)
Definition: bitvec.cpp:55
#define WordsInVectorOfSize(NumBits)
Definition: bitvec.h:63
void * Erealloc(void *ptr, int size)
Definition: emalloc.cpp:64
uinT32 * BIT_VECTOR
Definition: bitvec.h:28
BIT_VECTOR NewBitVector(int NumBits)
Definition: bitvec.cpp:90
BIT_VECTOR ExpandBitVector(BIT_VECTOR Vector, int NewNumBits)
Definition: bitvec.cpp:48
unsigned int uinT32
Definition: host.h:103
void * Emalloc(int Size)
Definition: emalloc.cpp:47
void Efree(void *ptr)
Definition: emalloc.cpp:79