22 static bool GetBit(
const int& BitN,
const uchar& Val);
31 typedef unsigned short int TB2;
128 const int& FlagN1,
const int& FlagN2=-1,
const int& FlagN3=-1,
129 const int& FlagN4=-1,
const int& FlagN5=-1,
const int& FlagN6=-1,
130 const int& FlagN7=-1,
const int& FlagN8=-1,
const int& FlagN9=-1);
138 if (
this!=&FSet){
B4V=FSet.
B4V;}
return *
this;}
156 bool In(
const int& FlagN)
const {
187 return (
B1>>MnBitN)==(BSet.
B1>>MnBitN);}
196 bool In(
const int& BitN)
const {
199 void SetBit(
const int& BitN,
const bool& Bool){
200 if (Bool)
Incl(BitN);
else Excl(BitN);}
210 void PutInt(
const int& MnBitN,
const int& MxBitN,
const int& Val){
211 Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<
Bits));
214 int GetInt(
const int& MnBitN,
const int& MxBitN)
const {
215 Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<
Bits));
229 return TB8Set(LBSet)&=RBSet;}
231 return TB8Set(LBSet)|=RBSet;}
233 return TB8Set(LBSet)^=RBSet;}
259 return (
B4>>MnBitN)==(BSet.
B4>>MnBitN);}
268 bool In(
const int& BitN)
const {
271 void SetBit(
const int& BitN,
const bool& Bool){
272 if (Bool)
Incl(BitN);
else Excl(BitN);}
284 void PutInt(
const int& MnBitN,
const int& MxBitN,
const int& Val){
285 Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<
Bits));
288 int GetInt(
const int& MnBitN,
const int& MxBitN)
const {
289 Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<
Bits));
318 void SetLastB4(){B4T[B4s-1]&=LastB4Mask;}
320 TBSet(): B4s(0), Bits(0), LastB4Mask(0), B4T(NULL){}
324 B4s(0), Bits(0), LastB4Mask(0), B4T(NULL){Gen(_Bits);}
338 bool operator==(
const TBSet& BSet)
const;
340 void Gen(
const int& _Bits);
345 Assert((0<=BitN)&&(BitN<Bits));
349 Assert((0<=BitN)&&(BitN<Bits));
352 bool In(
const int& BitN)
const {
353 Assert((0<=BitN)&&(BitN<Bits));
356 void SetBit(
const int& BitN,
const bool& Bool){
357 if (Bool){Incl(BitN);}
else {Excl(BitN);}}
359 Assert((0<=BitN)&&(BitN<Bits));
363 SetBit(BitN, !GetBit(BitN));}
368 Assert(Bits>=64);
uint64 Val; memcpy(&Val, B4T, 8);
return Val;}
372 for (
int B4N=0; B4N<B4s; B4N++){B4T[B4N]=~B4T[B4N];}
return *
this;}
375 for (
int B4N=0; B4N<B4s; B4N++){B4T[B4N]&=BSet.
B4T[B4N];}
return *
this;}
378 for (
int B4N=0; B4N<B4s; B4N++){B4T[B4N]|=BSet.
B4T[B4N];}
return *
this;}
380 Incl(BitN);
return *
this;}
383 for (
int B4N=0; B4N<B4s; B4N++){B4T[B4N]^=BSet.
B4T[B4N];}
return *
this;}
386 return ~
TBSet(BSet);}
388 return TBSet(LBSet)&=RBSet;}
390 return TBSet(LBSet)|=RBSet;}
392 return TBSet(LBSet)^=RBSet;}
395 return TBSet(LBSet)&=BitN;}
397 return TBSet(LBSet)|=BitN;}
399 return TBSet(LBSet)^=BitN;}
TB32Set & operator<<=(const int &ShiftBits)
bool operator<(const TB32Set &BSet) const
TB8Set & operator|=(const TB8Set &BSet)
TBSet & operator|=(const int &BitN)
TB8Set(const TB8Set &B8Set)
void SwitchBit(const int &BitN)
static uint GetP2(const int &P2Exp)
void SetBit(const int &BitN, const bool &Bool)
TB32Set & operator&=(const TB32Set &BSet)
bool IsPrefix(const TB8Set &BSet, const int &MnBitN) const
TFSet & operator|(const TFSet &FSet)
void SetBit(const int &BitN, const bool &Bool)
friend TBSet operator|(const TBSet &LBSet, const int &BitN)
TB2Def & operator=(const TB2Def &)
friend TB32Set operator&(const TB32Set &LBSet, const TB32Set &RBSet)
TB8Set & operator=(const TB8Set &BSet)
friend TB8Set operator^(const TB8Set &LBSet, const TB8Set &RBSet)
bool IsPrefix(const TB32Set &BSet, const int &MnBitN) const
void SetBit(const int &BitN, const bool &Bool)
bool GetBit(const int &BitN) const
void Incl(const int &FlagN)
friend TBSet operator|(const TBSet &LBSet, const TBSet &RBSet)
TB32Set & operator|=(const TB32Set &BSet)
static int GetL2(const uint &Val)
void PutInt(const int &MnBitN, const int &MxBitN, const int &Val)
TBSet & operator&=(const TBSet &BSet)
void SwitchBit(const int &BitN)
int GetInt(const int &MnBitN, const int &MxBitN) const
bool In(const int &BitN) const
TFSet(const TFSet &FSet1, const TFSet &FSet2)
static int GetL2(const TB2 &Val)
friend TB32Set operator^(const TB32Set &LBSet, const TB32Set &RBSet)
friend TBSet operator~(const TBSet &BSet)
TB32Set & operator^=(const TB32Set &BSet)
TB8Set & operator^=(const TB8Set &BSet)
void Save(TSOut &SOut) const
void Save(TSOut &SOut) const
void Excl(const int &BitN)
bool operator<(const TB8Set &BSet) const
void Save(TSOut &SOut) const
void Incl(const int &BitN)
#define ClassTPV(TNm, PNm, TNmV)
int GetInt(const int &MnBitN, const int &MxBitN) const
friend TB8Set operator|(const TB8Set &LBSet, const TB8Set &RBSet)
TFSet & operator=(const TFSet &FSet)
bool GetBit(const int &BitN) const
static uint GetP2(const int &P2Exp)
friend TBSet operator^(const TBSet &LBSet, const TBSet &RBSet)
void PutInt(const int &MnBitN, const int &MxBitN, const int &Val)
static int GetB1Bits(const TB1 &B1)
static bool GetBit(const int &BitN, const uchar &Val)
unsigned long long uint64
TB8Set & operator=(const uchar &_B1)
bool operator==(const TB32Set &BSet) const
static int GetL2(const uchar &Val)
void * LoadNewBf(const int &BfL)
TB32Set & operator>>=(const int &ShiftBits)
bool operator==(const TFSet &FSet) const
TB8Set & operator>>=(const int &ShiftBits)
TB8Set & operator|=(const int &BitN)
friend TB32Set operator|(const TB32Set &LBSet, const TB32Set &RBSet)
friend TB8Set operator&(const TB8Set &LBSet, const TB8Set &RBSet)
bool In(const int &BitN) const
TB8Set & operator&=(const TB8Set &BSet)
void Incl(const int &BitN)
friend TBSet operator&(const TBSet &LBSet, const int &BitN)
TBSet & operator|=(const TBSet &BSet)
TB32Set & operator=(const TB32Set &BSet)
TB1Def & operator=(const TB1Def &)
void SaveBf(const void *Bf, const TSize &BfL)
static int GetB4Bits(const TB4 &B4)
static const TB4Def B4Def
void Save(const bool &Bool)
static PBSet New(const int &Bits)
TB32Set(const TB32Set &B32Set)
static const TFSet EmptyFSet
static int GetB2Bits(const TB2 &B2)
void Incl(const TFSet &FSet)
bool In(const int &BitN) const
bool GetBit(const int &BitN) const
friend TB8Set operator~(const TB8Set &BSet)
void Save(TSOut &SOut) const
static const TB1Def B1Def
void LoadBf(const void *Bf, const TSize &BfL)
friend TB32Set operator~(const TB32Set &BSet)
void Incl(const int &BitN)
static PBSet Load(TSIn &SIn)
TBSet & operator^=(const TBSet &BSet)
bool operator==(const TB8Set &BSet) const
void Excl(const int &BitN)
void Save(TSOut &SOut) const
friend TBSet operator^(const TBSet &LBSet, const int &BitN)
void Excl(const int &BitN)
TFSet & operator|(const int &FlagN)
static uint GetP2(const int &P2Exp)
friend TBSet operator&(const TBSet &LBSet, const TBSet &RBSet)
TB8Set & operator<<=(const int &ShiftBits)
TB4Def & operator=(const TB4Def &)
static const TB2Def B2Def
bool In(const int &FlagN) const