SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
bits.h
Go to the documentation of this file.
1 #include "bd.h"
2 
4 // One byte
5 class TB1Def{
6 public:
7  typedef uchar TB1;
8  static const int B1Bits;
9  static const int MxP2Exp;
10  static const TB1 MxB1;
12  int* B1BitsT;
13 public:
14  TB1Def();
15  ~TB1Def(){delete[] B1P2T; delete[] B1BitsT;}
16 
17  TB1Def& operator=(const TB1Def&){Fail; return *this;}
18 
19  static int GetB1Bits(const TB1& B1);
20  static uint GetP2(const int& P2Exp);
21  static int GetL2(const uchar& Val);
22  static bool GetBit(const int& BitN, const uchar& Val);
23 
24  static const TB1Def B1Def;
25 };
26 
28 // Two bytes
29 class TB2Def{
30 public:
31  typedef unsigned short int TB2;
32  static const int B2Bits;
33  static const int MxP2Exp;
34  static const TB2 MxB2;
36 public:
37  TB2Def();
38  ~TB2Def(){delete[] B2P2T;}
39 
40  TB2Def& operator=(const TB2Def&){Fail; return *this;}
41 
42  static int GetB2Bits(const TB2& B2);
43  static uint GetP2(const int& P2Exp);
44  static int GetL2(const TB2& Val);
45 
46  static const TB2Def B2Def;
47 };
48 
50 // Four bytes
51 class TB4Def{
52 public:
53  typedef uint TB4;
54  static const int B4Bits;
55  static const int MxP2Exp;
56  static const TB4 MxB4;
58 public:
59  TB4Def();
60  ~TB4Def(){delete[] B4P2T;}
61 
62  TB4Def& operator=(const TB4Def&){Fail; return *this;}
63 
64  static int GetB4Bits(const TB4& B4);
65  static uint GetP2(const int& P2Exp);
66  static int GetL2(const uint& Val);
67 
68  static const TB4Def B4Def;
69 };
70 
72 // Flag-Set
73 /*class TFSet{
74 private:
75  static const int B4s;
76  static const int Bits;
77  TB4Def::TB4 B4T[4];
78 public:
79  TFSet(){
80  B4T[0]=0; B4T[1]=0; B4T[2]=0; B4T[3]=0;}
81  TFSet(const TFSet& FSet){
82  B4T[0]=FSet.B4T[0]; B4T[1]=FSet.B4T[1];
83  B4T[2]=FSet.B4T[2]; B4T[3]=FSet.B4T[3];}
84  TFSet(const int& FlagN){
85  B4T[0]=0; B4T[1]=0; B4T[2]=0; B4T[3]=0;
86  Assert((0<=FlagN)&&(FlagN<Bits));
87  B4T[FlagN/TB4Def::B4Def.B4Bits]=
88  TB4Def::B4Def.B4P2T[FlagN%TB4Def::B4Def.B4Bits];}
89 
90  TFSet& operator=(const TFSet& FSet){
91  if (this!=&FSet){
92  B4T[0]=FSet.B4T[0]; B4T[1]=FSet.B4T[1];
93  B4T[2]=FSet.B4T[2]; B4T[3]=FSet.B4T[3];}
94  return *this;}
95  bool operator==(const TFSet& FSet) const {
96  return
97  (B4T[0]==FSet.B4T[0])&&(B4T[1]==FSet.B4T[1])&&
98  (B4T[2]==FSet.B4T[2])&&(B4T[3]==FSet.B4T[3]);}
99  TFSet& operator|(const int& FlagN){
100  Assert((0<=FlagN)&&(FlagN<Bits));
101  B4T[FlagN/TB4Def::B4Def.B4Bits]|=
102  TB4Def::B4Def.B4P2T[FlagN%TB4Def::B4Def.B4Bits];
103  return *this;}
104  TFSet& operator|(const TFSet& FSet){
105  B4T[0]|=FSet.B4T[0]; B4T[1]|=FSet.B4T[1];
106  B4T[2]|=FSet.B4T[2]; B4T[3]|=FSet.B4T[3];
107  return *this;}
108 
109  bool Empty() const {
110  return (B4T[0]==0)&&(B4T[1]==0)&&(B4T[2]==0)&&(B4T[3]==0);}
111  bool In(const int& FlagN) const {
112  Assert((0<=FlagN)&&(FlagN<Bits));
113  return (B4T[FlagN/TB4Def::B4Def.B4Bits] &
114  TB4Def::B4Def.B4P2T[FlagN%TB4Def::B4Def.B4Bits])!=0;}
115 };*/
116 
118 // Flag-Set
119 class TFSet{
120 private:
121  static const int B4s;
122  static const int Bits;
124 public:
125  TFSet(): B4V(4, 4){}
126  TFSet(const TFSet& FSet): B4V(FSet.B4V){}
127  TFSet(
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);
131  TFSet(const TFSet& FSet1, const TFSet& FSet2):
132  B4V(4, 4){Incl(FSet1); Incl(FSet2);}
133  ~TFSet(){}
134  TFSet(TSIn& SIn): B4V(SIn){}
135  void Save(TSOut& SOut) const {B4V.Save(SOut);}
136 
137  TFSet& operator=(const TFSet& FSet){
138  if (this!=&FSet){B4V=FSet.B4V;} return *this;}
139  bool operator==(const TFSet& FSet) const {return B4V==FSet.B4V;}
140  TFSet& operator|(const int& FlagN){Incl(FlagN); return *this;}
141  TFSet& operator|(const TFSet& FSet){Incl(FSet); return *this;}
142 
143  void Clr(){
144  B4V[0]=0; B4V[1]=0; B4V[2]=0; B4V[3]=0;}
145  bool Empty() const {
146  return
147  (uint(B4V[0])==0)&&(uint(B4V[1])==0)&&
148  (uint(B4V[2])==0)&&(uint(B4V[3])==0);}
149  void Incl(const int& FlagN){
150  Assert((0<=FlagN)&&(FlagN<Bits));
151  B4V[FlagN/TB4Def::B4Def.B4Bits]|=
153  void Incl(const TFSet& FSet){
154  B4V[0]|=FSet.B4V[0]; B4V[1]|=FSet.B4V[1];
155  B4V[2]|=FSet.B4V[2]; B4V[3]|=FSet.B4V[3];}
156  bool In(const int& FlagN) const {
157  Assert((0<=FlagN)&&(FlagN<Bits));
158  return (B4V[FlagN/TB4Def::B4Def.B4Bits] &
159  TB4Def::B4Def.B4P2T[FlagN%TB4Def::B4Def.B4Bits])!=0;}
160 
161  static const TFSet EmptyFSet;
162 };
163 
165 // Bit8-Set
166 class TB8Set{
167 private:
168  static const int Bits;
170 public:
171  TB8Set(): B1(0){}
172  TB8Set(const TB8Set& B8Set): B1(B8Set.B1){}
173  TB8Set(const uchar& _B1): B1(_B1){}
174  TB8Set(TSIn& SIn){SIn.LoadBf(&B1, sizeof(TB1Def::TB1));}
175  void Save(TSOut& SOut) const {SOut.SaveBf(&B1, sizeof(TB1Def::TB1));}
176 
177  TB8Set& operator=(const TB8Set& BSet){B1=BSet.B1; return *this;}
178  TB8Set& operator=(const uchar& _B1){B1=_B1; return *this;}
179  bool operator==(const TB8Set& BSet) const {return B1==BSet.B1;}
180  bool operator<(const TB8Set& BSet) const {return B1<BSet.B1;}
181 
182  bool Empty() const {return B1==0;}
183  TB8Set& Clr(){B1=0; return *this;}
184  TB8Set& Fill(){B1=TB1Def::B1Def.MxB1; return *this;}
185  bool IsPrefix(const TB8Set& BSet, const int& MnBitN) const {
186  Assert((0<=MnBitN)&&(MnBitN<Bits));
187  return (B1>>MnBitN)==(BSet.B1>>MnBitN);}
188  uchar GetUCh() const {return B1;}
189 
190  void Incl(const int& BitN){
191  Assert((0<=BitN)&&(BitN<Bits));
192  B1|=TB1Def::B1Def.B1P2T[BitN];}
193  void Excl(const int& BitN){
194  Assert((0<=BitN)&&(BitN<Bits));
195  B1&=TB1Def::TB1(~(TB1Def::B1Def.B1P2T[BitN]));}
196  bool In(const int& BitN) const {
197  Assert((0<=BitN)&&(BitN<Bits));
198  return (B1 & TB1Def::B1Def.B1P2T[BitN])!=0;}
199  void SetBit(const int& BitN, const bool& Bool){
200  if (Bool) Incl(BitN); else Excl(BitN);}
201  bool GetBit(const int& BitN) const {
202  Assert((0<=BitN)&&(BitN<Bits));
203  return (B1 & TB1Def::B1Def.B1P2T[BitN])!=0;}
204  int GetBits() const {return Bits;}
205  int Get1s() const {return TB1Def::B1Def.GetB1Bits(B1);}
206  int Get0s() const {return Bits-Get1s();}
207  TStr GetStr() const;
208  void Wr();
209 
210  void PutInt(const int& MnBitN, const int& MxBitN, const int& Val){
211  Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<Bits));
212  B1 &= TB1Def::TB1((~(TB1Def::B1Def.B1P2T[MxBitN-MnBitN+1]-1)) << MnBitN);
213  B1 |= TB1Def::TB1((Val & (TB1Def::B1Def.B1P2T[MxBitN-MnBitN+1]-1)) << MnBitN);}
214  int GetInt(const int& MnBitN, const int& MxBitN) const {
215  Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<Bits));
216  return (B1>>MnBitN) & (TB1Def::B1Def.B1P2T[MxBitN-MnBitN+1]-1);}
217 
218  TB8Set& operator~(){B1=TB1Def::TB1(~B1); return *this;}
219  TB8Set& operator&=(const TB8Set& BSet){B1&=BSet.B1; return *this;}
220  TB8Set& operator|=(const TB8Set& BSet){B1|=BSet.B1; return *this;}
221  TB8Set& operator|=(const int& BitN){Incl(BitN); return *this;}
222  TB8Set& operator^=(const TB8Set& BSet){B1^=BSet.B1; return *this;}
223  TB8Set& operator>>=(const int& ShiftBits){B1>>=ShiftBits; return *this;}
224  TB8Set& operator<<=(const int& ShiftBits){B1<<=ShiftBits; return *this;}
225 
226  friend TB8Set operator~(const TB8Set& BSet){
227  return ~TB8Set(BSet);}
228  friend TB8Set operator&(const TB8Set& LBSet, const TB8Set& RBSet){
229  return TB8Set(LBSet)&=RBSet;}
230  friend TB8Set operator|(const TB8Set& LBSet, const TB8Set& RBSet){
231  return TB8Set(LBSet)|=RBSet;}
232  friend TB8Set operator^(const TB8Set& LBSet, const TB8Set& RBSet){
233  return TB8Set(LBSet)^=RBSet;}
234 };
236 
238 // Bit32-Set
239 class TB32Set{
240 private:
241  static const int Bits;
243 public:
244  TB32Set(): B4(0){}
245  TB32Set(const TB32Set& B32Set): B4(B32Set.B4){}
246  TB32Set(const uint& _B4): B4(_B4){}
247  TB32Set(TSIn& SIn){SIn.LoadBf(&B4, sizeof(TB4Def::TB4));}
248  void Save(TSOut& SOut) const {SOut.SaveBf(&B4, sizeof(TB4Def::TB4));}
249 
250  TB32Set& operator=(const TB32Set& BSet){B4=BSet.B4; return *this;}
251  bool operator==(const TB32Set& BSet) const {return B4==BSet.B4;}
252  bool operator<(const TB32Set& BSet) const {return B4<BSet.B4;}
253 
254  bool Empty() const {return B4==0;}
255  TB32Set& Clr(){B4=0; return *this;}
256  TB32Set& Fill(){B4=TB4Def::B4Def.MxB4; return *this;}
257  bool IsPrefix(const TB32Set& BSet, const int& MnBitN) const {
258  Assert((0<=MnBitN)&&(MnBitN<Bits));
259  return (B4>>MnBitN)==(BSet.B4>>MnBitN);}
260  uint GetUInt() const {return B4;}
261 
262  void Incl(const int& BitN){
263  Assert((0<=BitN)&&(BitN<Bits));
264  B4|=TB4Def::B4Def.B4P2T[BitN];}
265  void Excl(const int& BitN){
266  Assert((0<=BitN)&&(BitN<Bits));
267  B4&=~TB4Def::B4Def.B4P2T[BitN];}
268  bool In(const int& BitN) const {
269  Assert((0<=BitN)&&(BitN<Bits));
270  return (B4 & TB4Def::B4Def.B4P2T[BitN])!=0;}
271  void SetBit(const int& BitN, const bool& Bool){
272  if (Bool) Incl(BitN); else Excl(BitN);}
273  bool GetBit(const int& BitN) const {
274  Assert((0<=BitN)&&(BitN<Bits));
275  return (B4 & TB4Def::B4Def.B4P2T[BitN])!=0;}
276  void SwitchBit(const int& BitN){
277  SetBit(BitN, !GetBit(BitN));}
278  int GetBits() const {return Bits;}
279  int Get1s() const {return TB4Def::B4Def.GetB4Bits(B4);}
280  int Get0s() const {return Bits-Get1s();}
281  TStr GetStr() const;
282  void Wr();
283 
284  void PutInt(const int& MnBitN, const int& MxBitN, const int& Val){
285  Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<Bits));
286  B4 &= (~(TB4Def::B4Def.B4P2T[MxBitN-MnBitN+1]-1)) << MnBitN;
287  B4 |= (Val & (TB4Def::B4Def.B4P2T[MxBitN-MnBitN+1]-1)) << MnBitN;}
288  int GetInt(const int& MnBitN, const int& MxBitN) const {
289  Assert((0<=MnBitN)&&(MnBitN<=MxBitN)&&(MxBitN<Bits));
290  return (B4>>MnBitN) & (TB4Def::B4Def.B4P2T[MxBitN-MnBitN+1]-1);}
291 
292  TB32Set& operator~(){B4=~B4; return *this;}
293  TB32Set& operator&=(const TB32Set& BSet){B4&=BSet.B4; return *this;}
294  TB32Set& operator|=(const TB32Set& BSet){B4|=BSet.B4; return *this;}
295  //TB32Set& operator|=(const int& BitN){Incl(BitN); return *this;}
296  TB32Set& operator^=(const TB32Set& BSet){B4^=BSet.B4; return *this;}
297  TB32Set& operator>>=(const int& ShiftBits){B4>>=ShiftBits; return *this;}
298  TB32Set& operator<<=(const int& ShiftBits){B4<<=ShiftBits; return *this;}
299 
300  friend TB32Set operator~(const TB32Set& BSet){
301  return ~TB32Set(BSet);}
302  friend TB32Set operator&(const TB32Set& LBSet, const TB32Set& RBSet){
303  return TB32Set(LBSet)&=RBSet;}
304  friend TB32Set operator|(const TB32Set& LBSet, const TB32Set& RBSet){
305  return TB32Set(LBSet)|=RBSet;}
306  friend TB32Set operator^(const TB32Set& LBSet, const TB32Set& RBSet){
307  return TB32Set(LBSet)^=RBSet;}
308 };
310 
312 // Bit-Set
314 private:
315  int B4s, Bits;
316  TB4Def::TB4 LastB4Mask;
317  TB4Def::TB4* B4T;
318  void SetLastB4(){B4T[B4s-1]&=LastB4Mask;}
319 public:
320  TBSet(): B4s(0), Bits(0), LastB4Mask(0), B4T(NULL){}
321  TBSet(const TBSet& BSet);
322  PBSet Clone() const {return PBSet(new TBSet(*this));}
323  TBSet(const int& _Bits):
324  B4s(0), Bits(0), LastB4Mask(0), B4T(NULL){Gen(_Bits);}
325  static PBSet New(const int& Bits){return PBSet(new TBSet(Bits));}
326  ~TBSet(){delete[] B4T;}
327  TBSet(TSIn& SIn){
328  SIn.Load(B4s); SIn.Load(Bits);
329  SIn.LoadBf(&LastB4Mask, sizeof(TB4Def::TB4));
330  B4T=(TB4Def::TB4*)SIn.LoadNewBf(B4s*sizeof(TB4Def::TB4));}
331  static PBSet Load(TSIn& SIn){return new TBSet(SIn);}
332  void Save(TSOut& SOut) const {
333  SOut.Save(B4s); SOut.Save(Bits);
334  SOut.SaveBf(&LastB4Mask, sizeof(TB4Def::TB4));
335  SOut.SaveBf(B4T, B4s*sizeof(TB4Def::TB4));}
336 
337  TBSet& operator=(const TBSet& BSet);
338  bool operator==(const TBSet& BSet) const;
339 
340  void Gen(const int& _Bits);
341  void Clr();
342  void Fill();
343 
344  void Incl(const int& BitN){
345  Assert((0<=BitN)&&(BitN<Bits));
346  B4T[BitN/TB4Def::B4Def.B4Bits]|=
348  void Excl(const int& BitN){
349  Assert((0<=BitN)&&(BitN<Bits));
350  B4T[BitN/TB4Def::B4Def.B4Bits]&=
351  ~TB4Def::B4Def.B4P2T[BitN%TB4Def::B4Def.B4Bits];}
352  bool In(const int& BitN) const {
353  Assert((0<=BitN)&&(BitN<Bits));
354  return (B4T[BitN/TB4Def::B4Def.B4Bits] &
355  TB4Def::B4Def.B4P2T[BitN%TB4Def::B4Def.B4Bits])!=0;}
356  void SetBit(const int& BitN, const bool& Bool){
357  if (Bool){Incl(BitN);} else {Excl(BitN);}}
358  bool GetBit(const int& BitN) const {
359  Assert((0<=BitN)&&(BitN<Bits));
360  return (B4T[BitN/TB4Def::B4Def.B4Bits] &
361  TB4Def::B4Def.B4P2T[BitN%TB4Def::B4Def.B4Bits])!=0;}
362  void SwitchBit(const int& BitN){
363  SetBit(BitN, !GetBit(BitN));}
364  int GetBits() const {return Bits;}
365  int Get1s();
366  int Get0s(){return Bits-Get1s();}
367  uint64 GetUInt64() const {
368  Assert(Bits>=64); uint64 Val; memcpy(&Val, B4T, 8); return Val;}
369  void Wr();
370 
372  for (int B4N=0; B4N<B4s; B4N++){B4T[B4N]=~B4T[B4N];} return *this;}
373  TBSet& operator&=(const TBSet& BSet){
374  Assert(B4s==BSet.B4s);
375  for (int B4N=0; B4N<B4s; B4N++){B4T[B4N]&=BSet.B4T[B4N];} return *this;}
376  TBSet& operator|=(const TBSet& BSet){
377  Assert(B4s==BSet.B4s);
378  for (int B4N=0; B4N<B4s; B4N++){B4T[B4N]|=BSet.B4T[B4N];} return *this;}
379  TBSet& operator|=(const int& BitN){
380  Incl(BitN); return *this;}
381  TBSet& operator^=(const TBSet& BSet){
382  Assert(B4s==BSet.B4s);
383  for (int B4N=0; B4N<B4s; B4N++){B4T[B4N]^=BSet.B4T[B4N];} return *this;}
384 
385  friend TBSet operator~(const TBSet& BSet){
386  return ~TBSet(BSet);}
387  friend TBSet operator&(const TBSet& LBSet, const TBSet& RBSet){
388  return TBSet(LBSet)&=RBSet;}
389  friend TBSet operator|(const TBSet& LBSet, const TBSet& RBSet){
390  return TBSet(LBSet)|=RBSet;}
391  friend TBSet operator^(const TBSet& LBSet, const TBSet& RBSet){
392  return TBSet(LBSet)^=RBSet;}
393 
394  friend TBSet operator&(const TBSet& LBSet, const int& BitN){
395  return TBSet(LBSet)&=BitN;}
396  friend TBSet operator|(const TBSet& LBSet, const int& BitN){
397  return TBSet(LBSet)|=BitN;}
398  friend TBSet operator^(const TBSet& LBSet, const int& BitN){
399  return TBSet(LBSet)^=BitN;}
400 };
TB32Set & operator<<=(const int &ShiftBits)
Definition: bits.h:298
static const int Bits
Definition: bits.h:168
TB1Def::TB1 B1
Definition: bits.h:169
bool operator<(const TB32Set &BSet) const
Definition: bits.h:252
TStr GetStr() const
Definition: bits.cpp:148
TB32Set & Fill()
Definition: bits.h:256
TBSet(const int &_Bits)
Definition: bits.h:323
TB8Set & operator|=(const TB8Set &BSet)
Definition: bits.h:220
TBSet & operator|=(const int &BitN)
Definition: bits.h:379
TB8Set(const TB8Set &B8Set)
Definition: bits.h:172
Definition: bits.h:166
void SwitchBit(const int &BitN)
Definition: bits.h:276
static uint GetP2(const int &P2Exp)
Definition: bits.cpp:58
Definition: bits.h:5
Definition: bits.h:313
void SetBit(const int &BitN, const bool &Bool)
Definition: bits.h:356
Definition: bits.h:29
int * B1BitsT
Definition: bits.h:12
TB32Set & operator&=(const TB32Set &BSet)
Definition: bits.h:293
bool IsPrefix(const TB8Set &BSet, const int &MnBitN) const
Definition: bits.h:185
TB8Set & operator~()
Definition: bits.h:218
TB8Set & Clr()
Definition: bits.h:183
TFSet & operator|(const TFSet &FSet)
Definition: bits.h:141
void SetBit(const int &BitN, const bool &Bool)
Definition: bits.h:199
static const int MxP2Exp
Definition: bits.h:33
bool Empty() const
Definition: bits.h:145
unsigned int uint
Definition: bd.h:11
TB32Set & Clr()
Definition: bits.h:255
friend TBSet operator|(const TBSet &LBSet, const int &BitN)
Definition: bits.h:396
#define Fail
Definition: bd.h:238
unsigned short int TB2
Definition: bits.h:31
TB2Def & operator=(const TB2Def &)
Definition: bits.h:40
bool Empty() const
Definition: bits.h:254
TB4Def::TB4 B4
Definition: bits.h:242
TB8Set(TSIn &SIn)
Definition: bits.h:174
Definition: bits.h:119
TB8Set & Fill()
Definition: bits.h:184
friend TB32Set operator&(const TB32Set &LBSet, const TB32Set &RBSet)
Definition: bits.h:302
int Get0s() const
Definition: bits.h:280
static const int Bits
Definition: bits.h:241
TB8Set & operator=(const TB8Set &BSet)
Definition: bits.h:177
friend TB8Set operator^(const TB8Set &LBSet, const TB8Set &RBSet)
Definition: bits.h:232
bool IsPrefix(const TB32Set &BSet, const int &MnBitN) const
Definition: bits.h:257
void SetBit(const int &BitN, const bool &Bool)
Definition: bits.h:271
bool GetBit(const int &BitN) const
Definition: bits.h:273
void Wr()
Definition: bits.cpp:138
void Incl(const int &FlagN)
Definition: bits.h:149
TB32Set(const uint &_B4)
Definition: bits.h:246
TUIntV B4V
Definition: bits.h:123
TBSet(TSIn &SIn)
Definition: bits.h:327
friend TBSet operator|(const TBSet &LBSet, const TBSet &RBSet)
Definition: bits.h:389
TB1Def()
Definition: bits.cpp:7
int GetBits() const
Definition: bits.h:364
static const int MxP2Exp
Definition: bits.h:55
TB4Def()
Definition: bits.cpp:77
int Get0s()
Definition: bits.h:366
TB32Set & operator|=(const TB32Set &BSet)
Definition: bits.h:294
static int GetL2(const uint &Val)
Definition: bits.cpp:96
static const int MxP2Exp
Definition: bits.h:9
void PutInt(const int &MnBitN, const int &MxBitN, const int &Val)
Definition: bits.h:210
TBSet & operator&=(const TBSet &BSet)
Definition: bits.h:373
TFSet()
Definition: bits.h:125
void SwitchBit(const int &BitN)
Definition: bits.h:362
int GetInt(const int &MnBitN, const int &MxBitN) const
Definition: bits.h:214
bool In(const int &BitN) const
Definition: bits.h:196
TFSet(const TFSet &FSet1, const TFSet &FSet2)
Definition: bits.h:131
static const int B2Bits
Definition: bits.h:32
static int GetL2(const TB2 &Val)
Definition: bits.cpp:63
friend TB32Set operator^(const TB32Set &LBSet, const TB32Set &RBSet)
Definition: bits.h:306
friend TBSet operator~(const TBSet &BSet)
Definition: bits.h:385
uint GetUInt() const
Definition: bits.h:260
TB32Set & operator^=(const TB32Set &BSet)
Definition: bits.h:296
static const int B4s
Definition: bits.h:121
TB8Set & operator^=(const TB8Set &BSet)
Definition: bits.h:222
~TB2Def()
Definition: bits.h:38
~TFSet()
Definition: bits.h:133
Definition: fl.h:58
void Save(TSOut &SOut) const
Definition: ds.h:903
void Save(TSOut &SOut) const
Definition: bits.h:248
void Excl(const int &BitN)
Definition: bits.h:348
TB1 * B1P2T
Definition: bits.h:11
int GetBits() const
Definition: bits.h:204
bool operator<(const TB8Set &BSet) const
Definition: bits.h:180
TBSet()
Definition: bits.h:320
void Save(TSOut &SOut) const
Definition: bits.h:135
void Incl(const int &BitN)
Definition: bits.h:344
#define ClassTPV(TNm, PNm, TNmV)
Definition: bd.h:162
int GetInt(const int &MnBitN, const int &MxBitN) const
Definition: bits.h:288
friend TB8Set operator|(const TB8Set &LBSet, const TB8Set &RBSet)
Definition: bits.h:230
TFSet & operator=(const TFSet &FSet)
Definition: bits.h:137
bool GetBit(const int &BitN) const
Definition: bits.h:358
static uint GetP2(const int &P2Exp)
Definition: bits.cpp:22
bool Empty() const
Definition: bits.h:182
friend TBSet operator^(const TBSet &LBSet, const TBSet &RBSet)
Definition: bits.h:391
void PutInt(const int &MnBitN, const int &MxBitN, const int &Val)
Definition: bits.h:284
static const TB4 MxB4
Definition: bits.h:56
static int GetB1Bits(const TB1 &B1)
Definition: bits.cpp:18
static bool GetBit(const int &BitN, const uchar &Val)
Definition: bits.cpp:33
unsigned long long uint64
Definition: bd.h:38
TB8Set & operator=(const uchar &_B1)
Definition: bits.h:178
void Load(bool &Bool)
Definition: fl.h:84
bool operator==(const TB32Set &BSet) const
Definition: bits.h:251
void Clr()
Definition: bits.h:143
static const TB2 MxB2
Definition: bits.h:34
static int GetL2(const uchar &Val)
Definition: bits.cpp:27
void * LoadNewBf(const int &BfL)
Definition: fl.h:82
TB32Set & operator>>=(const int &ShiftBits)
Definition: bits.h:297
#define Assert(Cond)
Definition: bd.h:251
bool operator==(const TFSet &FSet) const
Definition: bits.h:139
TB8Set & operator>>=(const int &ShiftBits)
Definition: bits.h:223
TB32Set & operator~()
Definition: bits.h:292
TB8Set & operator|=(const int &BitN)
Definition: bits.h:221
friend TB32Set operator|(const TB32Set &LBSet, const TB32Set &RBSet)
Definition: bits.h:304
friend TB8Set operator&(const TB8Set &LBSet, const TB8Set &RBSet)
Definition: bits.h:228
bool In(const int &BitN) const
Definition: bits.h:268
TB8Set & operator&=(const TB8Set &BSet)
Definition: bits.h:219
void Incl(const int &BitN)
Definition: bits.h:262
TB32Set(TSIn &SIn)
Definition: bits.h:247
friend TBSet operator&(const TBSet &LBSet, const int &BitN)
Definition: bits.h:394
TB32Set()
Definition: bits.h:244
TBSet & operator|=(const TBSet &BSet)
Definition: bits.h:376
TB32Set & operator=(const TB32Set &BSet)
Definition: bits.h:250
TB1Def & operator=(const TB1Def &)
Definition: bits.h:17
unsigned char uchar
Definition: bd.h:10
void SaveBf(const void *Bf, const TSize &BfL)
Definition: fl.h:172
Definition: fl.h:128
TFSet(TSIn &SIn)
Definition: bits.h:134
TVec< TB32Set > TB32SetV
Definition: bits.h:309
Definition: bits.h:239
static int GetB4Bits(const TB4 &B4)
Definition: bits.cpp:83
static const TB4Def B4Def
Definition: bits.h:68
void Save(const bool &Bool)
Definition: fl.h:173
int Get1s() const
Definition: bits.h:205
int B4s
Definition: bits.h:315
static PBSet New(const int &Bits)
Definition: bits.h:325
TB32Set(const TB32Set &B32Set)
Definition: bits.h:245
static const TFSet EmptyFSet
Definition: bits.h:161
static int GetB2Bits(const TB2 &B2)
Definition: bits.cpp:52
int Get0s() const
Definition: bits.h:206
void Incl(const TFSet &FSet)
Definition: bits.h:153
static const TB1 MxB1
Definition: bits.h:10
bool In(const int &BitN) const
Definition: bits.h:352
static const int B1Bits
Definition: bits.h:8
bool GetBit(const int &BitN) const
Definition: bits.h:201
friend TB8Set operator~(const TB8Set &BSet)
Definition: bits.h:226
~TB4Def()
Definition: bits.h:60
TBSet & operator~()
Definition: bits.h:371
void Save(TSOut &SOut) const
Definition: bits.h:332
uchar TB1
Definition: bits.h:7
static const TB1Def B1Def
Definition: bits.h:24
Definition: dt.h:412
Definition: bits.h:51
int GetBits() const
Definition: bits.h:278
TPt< TBSet > PBSet
Definition: bits.h:313
TB2 * B2P2T
Definition: bits.h:35
TB8Set(const uchar &_B1)
Definition: bits.h:173
void LoadBf(const void *Bf, const TSize &BfL)
Definition: fl.h:81
static const int Bits
Definition: bits.h:122
TVec< TB8Set > TB8SetV
Definition: bits.h:235
~TBSet()
Definition: bits.h:326
friend TB32Set operator~(const TB32Set &BSet)
Definition: bits.h:300
TB4Def::TB4 * B4T
Definition: bits.h:317
void Incl(const int &BitN)
Definition: bits.h:190
Definition: bd.h:196
static PBSet Load(TSIn &SIn)
Definition: bits.h:331
TBSet & operator^=(const TBSet &BSet)
Definition: bits.h:381
uint TB4
Definition: bits.h:53
bool operator==(const TB8Set &BSet) const
Definition: bits.h:179
void Wr()
Definition: bits.cpp:155
void Excl(const int &BitN)
Definition: bits.h:265
void Save(TSOut &SOut) const
Definition: bits.h:175
int Get1s() const
Definition: bits.h:279
TStr GetStr() const
Definition: bits.cpp:131
friend TBSet operator^(const TBSet &LBSet, const int &BitN)
Definition: bits.h:398
void Excl(const int &BitN)
Definition: bits.h:193
TFSet & operator|(const int &FlagN)
Definition: bits.h:140
~TB1Def()
Definition: bits.h:15
uint64 GetUInt64() const
Definition: bits.h:367
static uint GetP2(const int &P2Exp)
Definition: bits.cpp:91
friend TBSet operator&(const TBSet &LBSet, const TBSet &RBSet)
Definition: bits.h:387
TB8Set & operator<<=(const int &ShiftBits)
Definition: bits.h:224
static const int B4Bits
Definition: bits.h:54
TB2Def()
Definition: bits.cpp:46
PBSet Clone() const
Definition: bits.h:322
uchar GetUCh() const
Definition: bits.h:188
TB8Set()
Definition: bits.h:171
TB4Def & operator=(const TB4Def &)
Definition: bits.h:62
TB4 * B4P2T
Definition: bits.h:57
static const TB2Def B2Def
Definition: bits.h:46
bool In(const int &FlagN) const
Definition: bits.h:156
TFSet(const TFSet &FSet)
Definition: bits.h:126