#include template struct bitcount { enum { value = (n & mask ? 1:0) + bitcount> 1>::value }; }; template struct bitcount { enum { value = 0 }; }; template struct bitposition { enum template class CompileTimeByteTable { public: CompileTimeByteTable : current(op::value) { } int operator[] (int i) { return *(¤t + i); } private: unsigned char current; CompileTimeByteTable next; }; static CompileTimeByteTable<256, bitcount> BitcountTable; #define mix(a,b,c) \ { \ a -= b; a -= c; a ^= (c>>13); \ b -= c; b -= a; b ^= (a<<8); \ c -= a; c -= b; c ^= (b>>13); \ a -= b; a -= c; a ^= (c>>12); \ b -= c; b -= a; b ^= (a<<16); \ c -= a; c -= b; c ^= (b>>5); \ a -= b; a -= c; a ^= (c>>3); \ b -= c; b -= a; b ^= (a<<10); \ c -= a; c -= b; c ^= (b>>15); \ } static const int kMaskStepSelectTable = std::limit::max;