Lines Matching refs:bitset
43 static void antlr3BitsetORInPlace (pANTLR3_BITSET bitset, pANTLR3_BITSET bitset2);
44 static ANTLR3_UINT32 antlr3BitsetSize (pANTLR3_BITSET bitset);
45 static void antlr3BitsetAdd (pANTLR3_BITSET bitset, ANTLR3_INT32 bit);
47 static ANTLR3_BOOLEAN antlr3BitsetMember (pANTLR3_BITSET bitset, ANTLR3_UINT32 bit);
48 static ANTLR3_UINT32 antlr3BitsetNumBits (pANTLR3_BITSET bitset);
49 static void antlr3BitsetRemove (pANTLR3_BITSET bitset, ANTLR3_UINT32 bit);
50 static ANTLR3_BOOLEAN antlr3BitsetIsNil (pANTLR3_BITSET bitset);
51 static pANTLR3_INT32 antlr3BitsetToIntList (pANTLR3_BITSET bitset);
55 static void growToInclude (pANTLR3_BITSET bitset, ANTLR3_INT32 bit);
56 static void grow (pANTLR3_BITSET bitset, ANTLR3_INT32 newSize);
60 static void antlr3BitsetFree (pANTLR3_BITSET bitset);
63 antlr3BitsetFree(pANTLR3_BITSET bitset) in antlr3BitsetFree() argument
65 if (bitset->blist.bits != NULL) in antlr3BitsetFree()
67 ANTLR3_FREE(bitset->blist.bits); in antlr3BitsetFree()
68 bitset->blist.bits = NULL; in antlr3BitsetFree()
70 ANTLR3_FREE(bitset); in antlr3BitsetFree()
78 pANTLR3_BITSET bitset; in antlr3BitsetNew() local
84 bitset = (pANTLR3_BITSET) ANTLR3_MALLOC((size_t)sizeof(ANTLR3_BITSET)); in antlr3BitsetNew()
86 if (bitset == NULL) in antlr3BitsetNew()
103 …bitset->blist.bits = (pANTLR3_BITWORD) ANTLR3_MALLOC((size_t)(numelements * sizeof(ANTLR3_BITWO… in antlr3BitsetNew()
104 memset(bitset->blist.bits, 0, (size_t)(numelements * sizeof(ANTLR3_BITWORD))); in antlr3BitsetNew()
105 bitset->blist.length = numelements; in antlr3BitsetNew()
107 if (bitset->blist.bits == NULL) in antlr3BitsetNew()
109 ANTLR3_FREE(bitset); in antlr3BitsetNew()
113 antlr3BitsetSetAPI(bitset); in antlr3BitsetNew()
118 return bitset; in antlr3BitsetNew()
122 antlr3BitsetSetAPI(pANTLR3_BITSET bitset) in antlr3BitsetSetAPI() argument
124 bitset->clone = antlr3BitsetClone; in antlr3BitsetSetAPI()
125 bitset->bor = antlr3BitsetOR; in antlr3BitsetSetAPI()
126 bitset->borInPlace = antlr3BitsetORInPlace; in antlr3BitsetSetAPI()
127 bitset->size = antlr3BitsetSize; in antlr3BitsetSetAPI()
128 bitset->add = antlr3BitsetAdd; in antlr3BitsetSetAPI()
129 bitset->grow = grow; in antlr3BitsetSetAPI()
130 bitset->equals = antlr3BitsetEquals; in antlr3BitsetSetAPI()
131 bitset->isMember = antlr3BitsetMember; in antlr3BitsetSetAPI()
132 bitset->numBits = antlr3BitsetNumBits; in antlr3BitsetSetAPI()
133 bitset->remove = antlr3BitsetRemove; in antlr3BitsetSetAPI()
134 bitset->isNilNode = antlr3BitsetIsNil; in antlr3BitsetSetAPI()
135 bitset->toIntList = antlr3BitsetToIntList; in antlr3BitsetSetAPI()
137 bitset->free = antlr3BitsetFree; in antlr3BitsetSetAPI()
143 pANTLR3_BITSET bitset; in antlr3BitsetCopy() local
148 bitset = (pANTLR3_BITSET) ANTLR3_MALLOC((size_t)sizeof(ANTLR3_BITSET)); in antlr3BitsetCopy()
150 if (bitset == NULL) in antlr3BitsetCopy()
166 bitset->blist.length = numElements; in antlr3BitsetCopy()
168 …bitset->blist.bits = (pANTLR3_BITWORD)ANTLR3_MALLOC((size_t)(numElements * sizeof(ANTLR3_BITWOR… in antlr3BitsetCopy()
170 if (bitset->blist.bits == NULL) in antlr3BitsetCopy()
172 ANTLR3_FREE(bitset); in antlr3BitsetCopy()
176 …ANTLR3_MEMCPY(bitset->blist.bits, blist->bits, (ANTLR3_UINT64)(numElements * sizeof(ANTLR3_BITWORD… in antlr3BitsetCopy()
180 return bitset; in antlr3BitsetCopy()
186 pANTLR3_BITSET bitset; in antlr3BitsetClone() local
190 bitset = antlr3BitsetNew(ANTLR3_BITSET_BITS * inSet->blist.length); in antlr3BitsetClone()
192 if (bitset == NULL) in antlr3BitsetClone()
199 …ANTLR3_MEMCPY(bitset->blist.bits, inSet->blist.bits, (ANTLR3_UINT64)(inSet->blist.length * sizeof(… in antlr3BitsetClone()
203 return bitset; in antlr3BitsetClone()
256 pANTLR3_BITSET bitset; in antlr3BitsetLoad() local
267 bitset = antlr3BitsetNew(0); in antlr3BitsetLoad()
269 if (bitset == NULL) in antlr3BitsetLoad()
281 if (bitset->blist.length <= count) in antlr3BitsetLoad()
283 bitset->grow(bitset, count+1); in antlr3BitsetLoad()
286 bitset->blist.bits[count] = *((inBits->bits)+count); in antlr3BitsetLoad()
293 return bitset; in antlr3BitsetLoad()
319 pANTLR3_BITSET bitset; in antlr3BitsetOf() local
331 bitset = antlr3BitsetNew(0); in antlr3BitsetOf()
333 if (bitset == NULL) in antlr3BitsetOf()
343 antlr3BitsetAdd(bitset, bit); in antlr3BitsetOf()
350 return bitset; in antlr3BitsetOf()
356 pANTLR3_BITSET bitset; in antlr3BitsetOR() local
370 bitset = antlr3BitsetClone(bitset1); in antlr3BitsetOR()
372 antlr3BitsetORInPlace(bitset, bitset2); in antlr3BitsetOR()
374 return bitset; in antlr3BitsetOR()
379 antlr3BitsetAdd(pANTLR3_BITSET bitset, ANTLR3_INT32 bit) in antlr3BitsetAdd() argument
385 if (word >= bitset->blist.length) in antlr3BitsetAdd()
387 growToInclude(bitset, bit); in antlr3BitsetAdd()
390 bitset->blist.bits[word] |= bitMask(bit); in antlr3BitsetAdd()
395 grow(pANTLR3_BITSET bitset, ANTLR3_INT32 newSize) in grow() argument
403 if (bitset->blist.bits != NULL) in grow()
407 …ANTLR3_MEMCPY((void *)newBits, (const void *)bitset->blist.bits, (size_t)(bitset->blist.length * s… in grow()
411 ANTLR3_FREE(bitset->blist.bits); in grow()
416 bitset->blist.bits = newBits; in grow()
417 bitset->blist.length = newSize; in grow()
421 growToInclude(pANTLR3_BITSET bitset, ANTLR3_INT32 bit) in growToInclude() argument
426 bl = (bitset->blist.length << 1); in growToInclude()
431 bitset->grow(bitset, bl); in growToInclude()
435 bitset->grow(bitset, nw); in growToInclude()
440 antlr3BitsetORInPlace(pANTLR3_BITSET bitset, pANTLR3_BITSET bitset2) in antlr3BitsetORInPlace() argument
454 if (bitset->blist.length < bitset2->blist.length) in antlr3BitsetORInPlace()
456 growToInclude(bitset, (bitset2->blist.length * sizeof(ANTLR3_BITWORD))); in antlr3BitsetORInPlace()
461 if (bitset->blist.length < bitset2->blist.length) in antlr3BitsetORInPlace()
463 minimum = bitset->blist.length; in antlr3BitsetORInPlace()
472 bitset->blist.bits[i-1] |= bitset2->blist.bits[i-1]; in antlr3BitsetORInPlace()
483 antlr3BitsetSize(pANTLR3_BITSET bitset) in antlr3BitsetSize() argument
495 for (i = bitset->blist.length - 1; i>= 0; i--) in antlr3BitsetSize()
497 if (bitset->blist.bits[i] != 0) in antlr3BitsetSize()
501 if ((bitset->blist.bits[i] & (((ANTLR3_BITWORD)1) << bit)) != 0) in antlr3BitsetSize()
571 antlr3BitsetMember(pANTLR3_BITSET bitset, ANTLR3_UINT32 bit) in antlr3BitsetMember() argument
577 if (wordNo >= bitset->blist.length) in antlr3BitsetMember()
582 if ((bitset->blist.bits[wordNo] & bitMask(bit)) == 0) in antlr3BitsetMember()
593 antlr3BitsetRemove(pANTLR3_BITSET bitset, ANTLR3_UINT32 bit) in antlr3BitsetRemove() argument
599 if (wordNo < bitset->blist.length) in antlr3BitsetRemove()
601 bitset->blist.bits[wordNo] &= ~(bitMask(bit)); in antlr3BitsetRemove()
605 antlr3BitsetIsNil(pANTLR3_BITSET bitset) in antlr3BitsetIsNil() argument
609 for (i = bitset->blist.length -1; i>= 0; i--) in antlr3BitsetIsNil()
611 if (bitset->blist.bits[i] != 0) in antlr3BitsetIsNil()
633 antlr3BitsetNumBits(pANTLR3_BITSET bitset) in antlr3BitsetNumBits() argument
635 return bitset->blist.length << ANTLR3_BITSET_LOG_BITS; in antlr3BitsetNumBits()
646 antlr3BitsetToIntList (pANTLR3_BITSET bitset) in antlr3BitsetToIntList() argument
655 numInts = bitset->size(bitset) + 1; in antlr3BitsetToIntList()
656 numBits = bitset->numBits(bitset); in antlr3BitsetToIntList()
671 if (bitset->isMember(bitset, i) == ANTLR3_TRUE) in antlr3BitsetToIntList()