Mercurial > hg > Applications > Grep
view regexParser/bitVector.cc @ 182:dbe004d03ef0 pairPro
implement stateAllocate()
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 24 Dec 2015 19:14:49 +0900 |
parents | 3bf2c6d6d53e |
children | ef798db705e9 |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "bitVector.h" BitVector createBitvector(int state) { unsigned long tmp = 1 << bitSetPosition; BitVector bi1 = (struct BitVector){.bitContainer = tmp}; return bi1; } BitVector bitSet(BitVector bi, int bitSetPosition) { unsigned long tmp = 1 << bitSetPosition; BitVector bi1 = (struct 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"); }