00001 00009 #ifndef BIN_INFO_HH 00010 #define BIN_INFO_HH 00011 00012 namespace mask{ 00013 00022 template<unsigned int N> 00023 struct BinInfo{ 00024 static const bool weakBit = N&1; 00025 static const unsigned int bloc0 = weakBit ? 0 : 1+BinInfo<N>>1>::bloc0; 00026 static const unsigned int bloc1 = weakBit ? ( BinInfo<N>>1>::weakBit ? 1+BinInfo<N>>1>::bloc1 : 1 ) 00027 : BinInfo<N>>1>::bloc1; 00028 // ou static const unsigned bloc1 = weakBit ? BinInfo<~N>::bloc0 : BinInfo<N>>1>::bloc1; 00029 }; 00030 00037 template<> 00038 struct BinInfo<0>{ 00039 static const bool weakBit = false; 00040 static const unsigned int bloc0 = 8*sizeof(int); 00041 static const unsigned int bloc1 = 0; 00042 }; 00043 00044 00045 }//namespace mask 00046 00047 #endif //BIN_INFO_HH