Go to the documentation of this file.
41 template<
unsigned nBits>
46 unsigned useSHL = ((1u << (nBits * offset)) - 1);
47 unsigned useSHR = (~0u >> (
sizeof(unsigned)*CHAR_BIT - nBits * offset));
50 <<
"PackedList<" << nBits <<
">" <<
nl
53 <<
" utilization: " << (nBits * offset) <<
nl;
57 << unsigned(nBits * offset) <<
nl
59 << unsigned((
sizeof(
unsigned)*CHAR_BIT) - nBits * offset)
66 <<
" useSHL: " << useSHL <<
nl
67 <<
" useSHR: " << useSHR <<
nl;
71 Info<<
"WARNING: different results for SHL and SHR" <<
nl;
82 int main(
int argc,
char *argv[])
92 "print an ascii representation of the storage"
100 Info<<
"bit width: " << unsigned(
sizeof(
unsigned)*CHAR_BIT) <<
endl;
128 const string& srcFile =
args[argI];
129 Info<<
nl <<
"reading " << srcFile <<
nl;
140 unsigned int rawCount = 0;
148 Info<<
"raw count: " << rawCount <<
nl
149 <<
"packed count: " << packLst.
count() <<
nl;
static SLList< string > validArgs
A list of valid (mandatory) arguments.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
#define forAll(list, i)
Loop across all elements in list.
label size() const
Return the number of arguments.
static unsigned int packing()
The number of entries per packed storage element.
static void addBoolOption(const word &opt, const string &usage="")
Add to a bool option to validOptions with usage information.
Extract command arguments and options from the supplied argc and argv parameters.
Ostream & endl(Ostream &os)
Add newline and flush stream.
int main(int argc, char *argv[])
static unsigned int maskLower(unsigned offset)
Masking for all bits below the offset.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
IOstream & dec(IOstream &io)
void printUsage() const
Print usage.
unsigned int count() const
Count number of bits set, O(log(n))
static Stream & writeDivider(Stream &os)
Write the standard file section divider.
Ostream & printInfo(Ostream &, const bool fullOutput=false) const
Print information and bit patterns (with printBits)
IOstream & hex(IOstream &io)
static unsigned int max_value()
The max. value for an entry, which simultaneously the bit-mask.
A dynamically allocatable list of packed unsigned integers.
bool optionFound(const word &opt) const
Return true if the named option is found.
label size() const
Number of entries.
static void noParallel()
Remove the parallel options.
Foam::argList args(argc, argv)