Mercurial > hg > Members > masakoha > testcode
view regexParser/bitVector.cc @ 324:879dc5d1cb6a default tip
fix
author | mir3636 |
---|---|
date | Fri, 27 May 2016 21:21:09 +0900 |
parents | 02031fb73af8 |
children |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "regexParser.h" BitVector createBitVector(int state) { unsigned long tmp = 1 << state; BitVector bi1 = (BitVector){.bitContainer = tmp}; return bi1; } BitVector bitSet(BitVector bi, int bitSetPosition) { unsigned long tmp = 1 << bitSetPosition; BitVector bi1 = (BitVector){.bitContainer = bi.bitContainer | tmp}; return bi1; } void bitPrint(BitVector bi) { unsigned long vec = bi.bitContainer; for (int j = 0; j < BITBLOCK; j++) { putchar((vec & 1) ? '1':'0'); vec >>= 1; } printf("\n"); }