Lines Matching refs:pBits
52 void dvmFreeBitVector(BitVector* pBits) in dvmFreeBitVector() argument
54 if (pBits == NULL) in dvmFreeBitVector()
57 free(pBits->storage); in dvmFreeBitVector()
58 free(pBits); in dvmFreeBitVector()
68 int dvmAllocBit(BitVector* pBits) in dvmAllocBit() argument
73 for (word = 0; word < pBits->storageSize; word++) { in dvmAllocBit()
74 if (pBits->storage[word] != 0xffffffff) { in dvmAllocBit()
78 bit = ffs(~(pBits->storage[word])) -1; in dvmAllocBit()
80 pBits->storage[word] |= 1 << bit; in dvmAllocBit()
88 if (!pBits->expandable) in dvmAllocBit()
91 pBits->storage = (u4*)realloc(pBits->storage, in dvmAllocBit()
92 (pBits->storageSize + kBitVectorGrowth) * sizeof(u4)); in dvmAllocBit()
93 memset(&pBits->storage[pBits->storageSize], 0x00, in dvmAllocBit()
95 pBits->storageSize += kBitVectorGrowth; in dvmAllocBit()
102 void dvmSetBit(BitVector* pBits, unsigned int num) in dvmSetBit() argument
104 if (num >= pBits->storageSize * sizeof(u4) * 8) { in dvmSetBit()
105 if (!pBits->expandable) { in dvmSetBit()
107 num, pBits->storageSize * sizeof(u4) * 8); in dvmSetBit()
113 assert(newSize > pBits->storageSize); in dvmSetBit()
114 pBits->storage = (u4*)realloc(pBits->storage, newSize * sizeof(u4)); in dvmSetBit()
115 if (pBits->storage == NULL) { in dvmSetBit()
119 memset(&pBits->storage[pBits->storageSize], 0x00, in dvmSetBit()
120 (newSize - pBits->storageSize) * sizeof(u4)); in dvmSetBit()
121 pBits->storageSize = newSize; in dvmSetBit()
124 pBits->storage[num >> 5] |= 1 << (num & 0x1f); in dvmSetBit()
130 void dvmClearBit(BitVector* pBits, unsigned int num) in dvmClearBit() argument
132 assert(num < pBits->storageSize * sizeof(u4) * 8); in dvmClearBit()
134 pBits->storage[num >> 5] &= ~(1 << (num & 0x1f)); in dvmClearBit()
140 void dvmClearAllBits(BitVector* pBits) in dvmClearAllBits() argument
142 unsigned int count = pBits->storageSize; in dvmClearAllBits()
143 memset(pBits->storage, 0, count * sizeof(u4)); in dvmClearAllBits()
151 void dvmSetInitialBits(BitVector* pBits, unsigned int numBits) in dvmSetInitialBits() argument
154 assert(((numBits + 31) >> 5) <= pBits->storageSize); in dvmSetInitialBits()
156 pBits->storage[idx] = -1; in dvmSetInitialBits()
160 pBits->storage[idx] = (1 << remNumBits) - 1; in dvmSetInitialBits()
167 bool dvmIsBitSet(const BitVector* pBits, unsigned int num) in dvmIsBitSet() argument
169 assert(num < pBits->storageSize * sizeof(u4) * 8); in dvmIsBitSet()
171 unsigned int val = pBits->storage[num >> 5] & (1 << (num & 0x1f)); in dvmIsBitSet()
178 int dvmCountSetBits(const BitVector* pBits) in dvmCountSetBits() argument
183 for (word = 0; word < pBits->storageSize; word++) { in dvmCountSetBits()
184 u4 val = pBits->storage[word]; in dvmCountSetBits()
281 void dvmBitVectorIteratorInit(BitVector* pBits, BitVectorIterator* iterator) in dvmBitVectorIteratorInit() argument
283 iterator->pBits = pBits; in dvmBitVectorIteratorInit()
284 iterator->bitSize = pBits->storageSize * sizeof(u4) * 8; in dvmBitVectorIteratorInit()
291 const BitVector* pBits = iterator->pBits; in dvmBitVectorIteratorNext() local
294 assert(iterator->bitSize == pBits->storageSize * sizeof(u4) * 8); in dvmBitVectorIteratorNext()
300 if (pBits->storage[wordIndex] & mask) { in dvmBitVectorIteratorNext()