Mercurial > hg > Applications > Grep
view regexParser/bitVector.cc @ 311:1d79e61a9365
CbC state generator is not work on -O2 but -O1
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 08 Feb 2016 22:12:14 +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"); }