Various bit-wise operations, etc. More...
Classes | |
struct | bitInfo |
An (unsigned) integral type adapter, for output of bit values. More... | |
Functions | |
unsigned int | count (const UList< bool > &bools, const bool val=true) |
Count number of 'true' entries. More... | |
bool | all (const UList< bool > &bools) |
True if all entries are 'true' or if the set is empty. More... | |
bool | any (const UList< bool > &bools) |
True if any entries are 'true'. More... | |
bool | none (const UList< bool > &bools) |
True if no entries are 'true'. More... | |
template<class UIntType > | |
unsigned int | bit_count (UIntType x) |
Count arbitrary number of bits (of an integral type) More... | |
template<> | |
unsigned int | bit_count (uint32_t x) |
Count bits in a 32-bit value (Hamming weight method) More... | |
template<> | |
unsigned int | bit_count (uint64_t x) |
Count bits in a 64-bit value (Hamming weight method) More... | |
template<class UIntType , unsigned BitWidth> | |
UIntType | repeat_value (unsigned val) |
Repeat a value of the given BitWidth into the destination output type. More... | |
template<class UIntType > | |
Ostream & | print (Ostream &os, UIntType value, char off='0', char on='1') |
Print 0/1 bits in the (unsigned) integral type. More... | |
Various bit-wise operations, etc.
The population count uses the Hamming weight (http://en.wikipedia.org/wiki/Hamming_weight).
Count number of 'true' entries.
val | can be set to false to count the number of false values instead For compatibility with bitSet::count() |
Definition at line 74 of file BitOps.H.
Referenced by geometric::add(), triSurfaceMesh::addFaceToEdge(), IOobjectList::append(), CStringList::asList(), UOPstream::beginRawWrite(), MeshedSurface< Foam::face >::checkZones(), surfMesh::checkZones(), probes::classifyFields(), hexRef8::consistentSlowRefinement(), Foam::stringOps::count(), cellCellStencil::count(), objectRegistry::count(), IOobjectList::count(), HashTable< Foam::phase * >::countEntries(), IOobjectList::countImpl(), objectRegistry::countImpl(), HashTable< Foam::phase * >::countKeys(), IOobjectList::countTypeImpl(), objectRegistry::countTypeImpl(), HashTable< Foam::phase * >::countValues(), decompositionMethod::decompose(), snappyVoxelMeshDriver::doRefine(), Foam::duplicateOrder(), limitFields::execute(), NURBS3DVolume::findPointsInBox(), ISstream::getLine(), hashedWordList::hashedWordList(), Histogram< List >::Histogram(), Foam::indicesImpl(), ZoneMesh< cellZone, polyMesh >::indicesImpl(), InjectionModelList< Foam::KinematicCloud< Cloud< basicKinematicCollidingParcel > > >::InjectionModelList(), Foam::inplaceSubset(), Foam::inplaceSubsetList(), Foam::inplaceSubsetMatchingStrings(), wordRes::matching(), scalars::matching(), regionProperties::names(), Foam::namesImpl(), IOobjectList::namesImpl(), objectRegistry::namesImpl(), ZoneMesh< cellZone, polyMesh >::namesImpl(), IOobjectList::namesTypeImpl(), objectRegistry::namesTypeImpl(), UOprocess::newField(), polySurface::nFaceData(), blockMesh::numZonedBlocks(), ParticleForceList< KinematicCloud< Cloud< basicKinematicCollidingParcel > > >::ParticleForceList(), points_delaunay_naive_2d(), ParticleTracks< CloudType >::postFace(), Foam::printHostsSubscription(), HashTable< Foam::phase * >::printInfo(), FIRECore::putFireLabels(), ensightReadFile::read(), FixedValueConstraint< Type >::read(), UIPstream::read(), ISstream::read(), masterUncollatedFileOperation::readAndSend(), lumpedPointState::readPlain(), UIPstream::readRaw(), ISstream::readRaw(), FIREMeshReader::readSelections(), MRFZoneList::reset(), porosityModelList::reset(), optionAdjointList::reset(), optionList::reset(), SemiImplicitSource< Type >::setFieldData(), lumpedPointDisplacementPointPatchVectorField::setInterpolators(), lumpedPointDisplacementPointPatchVectorField::setPatchControls(), Foam::ListOps::setValue(), Foam::vtk::sizeofData(), ensightFaces::sizes(), ensightCells::sizes(), snappyVoxelMeshDriver::snappyVoxelMeshDriver(), regionProperties::sortedNames(), Foam::subsetMatchingStrings(), surfaceFeatures::surfaceFeatures(), Foam::system(), bitSet::toc(), HashTable< Foam::phase * >::toc(), HashTable< Foam::phase * >::tocEntries(), HashTable< Foam::phase * >::tocKeys(), HashTable< Foam::phase * >::tocValues(), wordRes::uniq(), hashedWordList::uniq(), Foam::uniqueOrder(), trackingInverseDistance::update(), cellVolumeWeight::update(), inverseDistance::update(), PtrListDetail< Foam::diameterModels::velocityGroup >::write(), prefixOSstream::write(), OSstream::write(), UOPstream::write(), ensightFile::write(), histogram::write(), Foam::writeAllAreaFields(), Foam::writeAllDimFields(), Foam::writeAllPointFields(), Foam::writeAllVolFields(), Foam::writeAreaFields(), Foam::ensightOutput::writeCloudField(), Foam::writeDimFields(), advancingFrontAMI::writeIntersectionOBJ(), Foam::meshTools::writeOBJ(), Foam::writePointFields(), OSstream::writeRaw(), UOPstream::writeRaw(), cellClassification::writeStats(), vtkWrite::writeVolFields(), ensightWrite::writeVolFields(), Foam::writeVolFields(), memorybuf::in::xsgetn(), and memorybuf::out::xsputn().
True if all entries are 'true' or if the set is empty.
For compatibility with bitSet::all()
Definition at line 81 of file BitOps.H.
Referenced by decompositionMethod::decompose().
True if any entries are 'true'.
For compatibility with bitSet::any()
Definition at line 88 of file BitOps.H.
Referenced by boolVector::none(), and bitSet::toc().
True if no entries are 'true'.
For compatibility with bitSet::none()
|
inline |
Count arbitrary number of bits (of an integral type)
Definition at line 103 of file BitOps.H.
Referenced by bitSet::count().
|
inline |
|
inline |
|
inline |
Print 0/1 bits in the (unsigned) integral type.
Definition at line 172 of file BitOps.H.
References IOstreamOption::BINARY, and IOstreamOption::format().
Referenced by if(), Foam::operator<<(), dynamicIndexedOctree< Foam::dynamicTreeDataPoint >::print(), indexedOctree< Foam::treeDataPrimitivePatch< PatchType > >::print(), PackedList< 2 >::printBits(), sampledPlane::update(), sampledPatch::update(), and seriesWriter::write().