Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site











SourceForge.net Logo

Bits

 

class Bits : private Moveable<Bits

Bits is a simple container class representing "unlimited" array of bools, implemented using binary arrays, packing 8 bits per byte of allocated space (plus some allocation reserve). It is moveable type with pick transfer sematics.

 

Public Method List

 

void Clear()

Sets all bools to false.

 


 

void Set(int i, bool b = true)

Sets bit i to b .

 


 

bool Get(int iconst

bool operator[](int iconst

Returns the value of bool i.

 


 

void Set(int i, dword bits, int count)

Sets count bits (bits LSB is first) starting ati.

 


 

dword Get(int i, int count)

Returns a set of count bits (at most 32) starting at i, as binary number. First bit is returned as LSB.

 


 

void Set64(int i, uint64 bits, int count)

Sets count bits (bits LSB is first) starting from i.

 


 

uint64 Get64(int i, int count)

Returns a set of count bits (at most 64) starting at i, as binary number. First bit is returned as LSB.

 


 

void SetN(int i, bool b, int count)

Sets count bits, starting from i, to b.

 


 

void SetN(int i, int count)

Sets count bits, starting from i, to true.

 


 

void Reserve(int nbits)

Preallocates internal storage for nbits bits, avoiding further reallocations during Set (as long as only nbits are used).

 


 

void Shrink()

Tries to reduce internal storage.

 


 

dword *CreateRaw(int n_dwords)

Creates a new internal storage for n_dwords dwords (sizeof(dword) * n_dwords bits) and returns a pointer to it. Bits are numbered from LSB, client code has to account for endiannes.

 


 

const dword *Raw(int& n_dwordsconst

dword *Raw(int& n_dwords)

Returns a pointer to internal storage and the size of internal storage. Bits are numbered from LSB, client code has to account for endiannes.

 


 

void Serialize(Stream& s)

Serializes Bits. Serialize resolves eventual endiannes issue.

 

 

Last edit by cxl on 05/16/2017. Do you want to contribute?. T++