Mercurial > hg > Members > masakoha > testcode
diff c/regexParser/bitVector.cc @ 117:166136236891 pairPro
add header files
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 25 Nov 2015 14:58:03 +0900 (2015-11-25) |
parents | 66c633575b53 |
children | c292c67b3100 |
line wrap: on
line diff
--- a/c/regexParser/bitVector.cc Tue Nov 24 17:07:08 2015 +0900 +++ b/c/regexParser/bitVector.cc Wed Nov 25 14:58:03 2015 +0900 @@ -5,8 +5,6 @@ extern BitVectorListPtr allocateBitVectorList(); const BitVectorPtr allocateBitVector(); -int bitBlock = sizeof(unsigned long) * 8; - BitVectorListPtr createBitVector(NodePtr n,BitVectorListPtr bvl) { BitVectorListPtr nextBvl = allocateBitVectorList(); nextBvl->bi = bitSet(n->nodeNumber); @@ -38,11 +36,11 @@ BitVectorPtr bi = allocateBitVector(); - bi->arrayNum = (bitSetPosition + bitBlock) / bitBlock; + bi->arrayNum = (bitSetPosition + BITBLOCK) / BITBLOCK; - int arrayPosition = bitSetPosition / bitBlock; + int arrayPosition = bitSetPosition / BITBLOCK; - unsigned long tmp = 1 << (bitSetPosition % bitBlock); + unsigned long tmp = 1 << (bitSetPosition % BITBLOCK); bi->bitContainer[arrayPosition] = bi->bitContainer[arrayPosition] | tmp; return bi; @@ -51,7 +49,7 @@ void bitPrint(BitVectorPtr bi) { for (int i = 0; i < bi->arrayNum ; i++) { unsigned long vec = bi->bitContainer[i]; - for (int j = 0; j < bitBlock; j++) { + for (int j = 0; j < BITBLOCK; j++) { printf( "%lu", vec & 1 ); vec >>= 1; }