7#ifndef PXR_BASE_TF_COMPRESSED_BITS_H
8#define PXR_BASE_TF_COMPRESSED_BITS_H
11#include "pxr/base/tf/api.h"
23PXR_NAMESPACE_OPEN_SCOPE
64 typedef uint32_t _WordType;
74 static const uint32_t LOCAL_SIZE = 6;
78 _numAllocated(LOCAL_SIZE),
81 _WordArray(
const _WordArray &rhs) :
83 _numAllocated(LOCAL_SIZE),
92 _WordArray& operator=(
const _WordArray &rhs) {
107 void PushBack(_WordType value) {
109 if (_num >= _numAllocated) {
124 void PopBackNum(uint32_t popNum) {
130 void MoveInto(_WordArray &rhs) {
131 rhs._numAllocated = _numAllocated;
137 if (_IsStoredLocally()) {
140 for (
size_t i = 0; i < LOCAL_SIZE; ++i) {
141 rhs._data[i] = _data[i];
152 _numAllocated = LOCAL_SIZE;
157 void Swap(_WordArray &rhs) {
158 if (!_IsStoredLocally() && !rhs._IsStoredLocally()) {
159 std::swap(_data, rhs._data);
160 std::swap(_numAllocated, rhs._numAllocated);
161 std::swap(_num, rhs._num);
164 std::swap(*
this, rhs);
169 _WordType &operator[](
size_t index) {
173 const _WordType &operator[](
size_t index)
const {
178 uint32_t GetNum()
const {
183 uint32_t GetNumAllocated()
const {
184 return _numAllocated;
188 const _WordType *Begin()
const {
193 const _WordType *End()
const {
202 const _WordType &Front()
const {
208 return _data[_num - 1];
211 const _WordType &Back()
const {
212 return _data[_num - 1];
216 bool _IsStoredLocally()
const {
217 return _data == _local;
221 if (!_IsStoredLocally()) {
227 void _Duplicate(
const _WordArray &rhs) {
229 if (_numAllocated < rhs._num) {
231 _data =
new _WordType[rhs._numAllocated];
232 _numAllocated = rhs._numAllocated;
235 if (rhs._IsStoredLocally()) {
238 for (
size_t i = 0; i < LOCAL_SIZE; ++i) {
239 _data[i] = rhs._data[i];
242 memcpy(_data, rhs._data,
sizeof(_WordType) * rhs._num);
251 _WordType *newData =
new _WordType[_numAllocated];
252 memcpy(newData, _data,
sizeof(_WordType) * _num);
261 _WordType _local[LOCAL_SIZE];
264 uint32_t _numAllocated;
274 enum class Mode { All, AllSet, AllUnset, Platforms };
304 bits._platforms.GetNum());
307 const uint32_t n = std::min<uint32_t>(
308 bits._platforms.GetNum(),
310 for (uint32_t i = 0; i < n; ++i) {
323 _platforms.PushBack(num);
334 _platforms.PushBack(0);
339 if (!
TF_VERIFY(first < num && last < num && first <= last)) {
340 _platforms.PushBack(num);
344 size_t trailingZeroes = 0;
345 const size_t range = last - first + 1;
348 _platforms.PushBack(range);
349 trailingZeroes = num - range;
351 _platforms.PushBack(first);
352 _platforms.PushBack(range);
353 trailingZeroes = num - last - 1;
359 if (trailingZeroes != 0) {
360 _platforms.PushBack(trailingZeroes);
367 _platforms(rhs._platforms),
369 _runningBit(rhs._runningBit) {}
376 _platforms(rhs._platforms),
378 _runningBit(1 - rhs._runningBit) {
393 _runningBit(rhs._runningBit) {
394 rhs._platforms.MoveInto(_platforms);
395 rhs._platforms.Clear();
411 _platforms = rhs._platforms;
413 _runningBit = rhs._runningBit;
426 _runningBit = rhs._runningBit;
427 rhs._platforms.MoveInto(_platforms);
428 rhs._platforms.Clear();
445 _platforms.PushBack(0);
453 if ((UINT32_C(1) - _runningBit) ==
454 (_platforms.GetNum() & UINT32_C(1))) {
455 _platforms.Back() += (num - _num);
457 _platforms.PushBack(num - _num);
462 else if (_num > num) {
463 uint32_t diff = _num - num;
464 while (_platforms.Back() <= diff) {
465 diff -= _platforms.Back();
466 _platforms.PopBack();
468 _platforms.Back() -= diff;
477 std::swap(_num, rhs._num);
478 std::swap(_runningBit, rhs._runningBit);
479 _platforms.Swap(rhs._platforms);
485 if (_num <= 0 || (_runningBit == 0 && _platforms.GetNum() == 1)) {
491 _platforms.PushBack(_num);
497 if (_num <= 0 || (_runningBit == 1 && _platforms.GetNum() == 1)) {
503 _platforms.PushBack(_num);
558 const bool lastValue = _runningBit == (_platforms.GetNum() & 1);
559 if (value == lastValue) {
560 _platforms.Back() += num;
562 _platforms.PushBack(num);
582 if (_num == 0 || bits == 0) {
587 if (_runningBit == 0) {
588 _platforms.Front() += bits;
596 _platforms.PushBack(0);
597 for (
size_t i = _platforms.GetNum() - 1; i > 0; --i) {
598 _platforms[i] = _platforms[i - 1];
600 _platforms[0] = bits;
604 while (_platforms.Back() <= bits) {
605 bits -= _platforms.Back();
606 _platforms.PopBack();
608 _platforms.Back() -= bits;
615 if (_num == 0 || bits == 0) {
620 size_t trimBits = bits;
621 size_t platformIndex = 0;
622 while (platformIndex < _platforms.GetNum() &&
623 _platforms[platformIndex] <= trimBits) {
624 trimBits -= _platforms[platformIndex];
630 if (platformIndex < _platforms.GetNum()) {
631 _platforms[platformIndex] -= trimBits;
639 if (platformIndex > 0) {
642 const size_t last = _platforms.GetNum() - platformIndex;
643 for (
size_t i = 0; i < last; ++i) {
644 _platforms[i] = _platforms[i + platformIndex];
646 _platforms.PopBackNum(platformIndex);
649 if (platformIndex & 1) {
650 _runningBit = 1 - _runningBit;
656 if ((UINT32_C(1) - _runningBit) ==
657 (_platforms.GetNum() & UINT32_C(1))) {
658 _platforms.Back() += bits;
664 _platforms.PushBack(std::min<_WordType>(_num, bits));
677 size_t platformIndex, bitCount;
678 return _LinearSearch(index, &platformIndex, &bitCount) == 1;
693 uint8_t bit = _runningBit;
697 for (
size_t i = 0; i < _platforms.GetNum(); ++i) {
698 const _WordType platform = _platforms[i];
705 if (((count + platform) * bit) > nth) {
706 return index + (nth - count);
710 count += (platform * bit);
730 size_t platformIndex, bitCount;
731 const uint8_t bit = _LinearSearch(index, &platformIndex, &bitCount);
752 size_t platformIndex, bitCount;
753 const uint8_t bit = _LinearSearch(index, &platformIndex, &bitCount);
759 const size_t first = bitCount - _platforms[platformIndex];
779 size_t platformIndex, bitCount;
780 const uint8_t bit = _LinearSearch(index, &platformIndex, &bitCount);
791 void Count(
size_t *numSet,
size_t *maxGap)
const {
792 const uint32_t lastIndex = _platforms.GetNum() - 1;
795 uint8_t bit = _runningBit;
796 for (
size_t i = 0; i < _platforms.GetNum(); ++i) {
799 num += _platforms[i];
802 else if (i > 0 && i < lastIndex) {
803 max = std::max(max, _platforms[i]);
827 if (_num == 0 || _runningBit == 1) {
831 return _platforms.Front();
839 if (_num == 0 || (_runningBit == 0 && _platforms.GetNum() == 1)) {
845 if (_runningBit == (_platforms.GetNum() & 1)) {
849 return _num - 1 - _platforms.Back();
856 for (
size_t i = 1 - _runningBit; i < _platforms.GetNum(); i += 2) {
857 numSet += _platforms[i];
869 return _platforms.GetNum();
879 const uint32_t numP = _platforms.GetNum();
880 return (numP / 2) + (numP & _runningBit);
890 const uint32_t numP = _platforms.GetNum();
891 return (numP / 2) + (numP & (1 - _runningBit));
897 return _num == 0 || (_runningBit == 1 && _platforms.GetNum() == 1);
909 return _num > 0 && (_runningBit == 1 || _platforms.GetNum() > 1);
915 return _num > 0 && (_runningBit == 0 || _platforms.GetNum() > 1);
923 const uint32_t numP = _platforms.GetNum();
925 _num > 0 && numP <= 3 &&
927 (_runningBit == 1 && numP == 1) ||
928 (_runningBit == 0 && numP == 3));
936 if (_platforms.GetNumAllocated() > _WordArray::LOCAL_SIZE) {
937 size +=
sizeof(_WordType) * _platforms.GetNumAllocated();
987 if (
this == &rhs || (_num == 0 && rhs._num == 0)) {
992 if (_num == rhs._num &&
993 _runningBit == rhs._runningBit &&
994 _platforms.GetNum() == rhs._platforms.GetNum()) {
997 for (
size_t i = 0; i < _platforms.GetNum(); ++i) {
999 if (_platforms[i] != rhs._platforms[i]) {
1015 return !(*
this == rhs);
1024 _num == 0 || rhs._num == 0) {
1028 const uint32_t numA = _platforms.GetNum();
1029 const uint32_t numB = rhs._platforms.GetNum();
1030 const uint8_t bitA = _runningBit;
1031 const uint8_t bitB = rhs._runningBit;
1040 _platforms = rhs._platforms;
1055 if (_AreBoundsDisjoint(rhs)) {
1060 return _Logical<_And>(bitB, rhs._platforms);
1077 _num == 0 || rhs._num == 0) {
1081 const uint32_t numA = _platforms.GetNum();
1082 const uint32_t numB = rhs._platforms.GetNum();
1083 const uint8_t bitA = _runningBit;
1084 const uint8_t bitB = rhs._runningBit;
1093 _platforms = rhs._platforms;
1117 return _Logical<_Or>(bitB, rhs._platforms);
1135 _num == 0 || rhs._num == 0) {
1150 return _Logical<_Xor>(rhs._runningBit, rhs._platforms);
1168 _num == 0 || rhs._num == 0) {
1172 const uint32_t numA = _platforms.GetNum();
1173 const uint32_t numB = rhs._platforms.GetNum();
1174 const uint8_t bitA = _runningBit;
1175 const uint8_t bitB = rhs._runningBit;
1183 _runningBit = 1 - bitB;
1184 _platforms = rhs._platforms;
1207 return _Logical<_And>(1 - bitB, rhs._platforms);
1224 _runningBit = 1 - _runningBit;
1234 return IsSet(index);
1278 _num == 0 || rhs._num == 0) {
1282 uint8_t bitA = _runningBit;
1283 uint8_t bitB = rhs._runningBit;
1288 const uint32_t numA = _platforms.GetNum();
1289 const uint32_t numB = rhs._platforms.GetNum();
1307 if (_AreBoundsDisjoint(rhs)) {
1311 return _HasLogical<_And>(bitB, rhs._platforms);
1321 _num == 0 || rhs._num == 0) {
1325 uint8_t bitA = _runningBit;
1326 uint8_t bitB = rhs._runningBit;
1327 if (bitA && !bitB) {
1331 const uint32_t numA = _platforms.GetNum();
1332 const uint32_t numB = rhs._platforms.GetNum();
1354 if (firstSet < rhsFirstSet) {
1361 if (lastSet > rhsLastSet ||
1362 firstSet > rhsLastSet ||
1363 lastSet < rhsFirstSet) {
1367 return _HasLogical<_And>(1 - bitB, rhs._platforms);
1393 template <Mode mode>
1399 inline AllView GetAllView()
const;
1419 inline uint8_t operator() (uint8_t a, uint8_t b) {
1426 inline uint8_t operator() (uint8_t a, uint8_t b) {
1433 inline uint8_t operator() (uint8_t a, uint8_t b) {
1443 _Logical(uint8_t rhsRunningBit,
const _WordArray &rhsPlatforms) {
1446 const uint32_t numA = _platforms.GetNum();
1447 const uint32_t numB = rhsPlatforms.GetNum();
1448 uint8_t bitA = _runningBit;
1449 uint8_t bitB = rhsRunningBit;
1451 uint8_t b = op(bitA, bitB);
1457 _WordType platformA = _platforms[indexA];
1458 _WordType platformB = rhsPlatforms[indexB];
1460 uint32_t newTotal = 0;
1461 _WordType newPlatform = 0;
1464 if (platformA < platformB) {
1465 newTotal += platformA;
1466 newPlatform += platformA;
1470 const uint8_t newBit = op(bitA, bitB);
1472 result.PushBack(newPlatform);
1479 platformB = platformB - platformA;
1480 if (indexA == numA) {
1481 platformA = _num - newTotal;
1482 }
else if (indexA < numA) {
1483 platformA = _platforms[indexA];
1486 }
else if (platformA > platformB) {
1487 newTotal += platformB;
1488 newPlatform += platformB;
1492 const uint8_t newBit = op(bitA, bitB);
1494 result.PushBack(newPlatform);
1501 platformA = platformA - platformB;
1502 if (indexB == numB) {
1503 platformB = _num - newTotal;
1504 }
else if(indexB < numB) {
1505 platformB = rhsPlatforms[indexB];
1509 newTotal += platformA;
1510 newPlatform += platformA;
1515 const uint8_t newBit = op(bitA, bitB);
1516 if (newBit != b || newTotal >= _num) {
1517 result.PushBack(newPlatform);
1522 if (newTotal >= _num)
1527 if (indexA == numA) {
1528 platformA = _num - newTotal;
1529 }
else if (indexA < numA) {
1530 platformA = _platforms[indexA];
1534 if (indexB == numB) {
1535 platformB = _num - newTotal;
1536 }
else if (indexB < numB) {
1537 platformB = rhsPlatforms[indexB];
1542 result.MoveInto(_platforms);
1549 template <
class OP >
bool
1550 _HasLogical(uint8_t rhsRunningBit,
const _WordArray &rhsPlatforms)
const {
1553 uint8_t bitA = _runningBit;
1554 uint8_t bitB = rhsRunningBit;
1555 const uint32_t numA = _platforms.GetNum();
1556 const uint32_t numB = rhsPlatforms.GetNum();
1560 _WordType sumPlatformA = _platforms[indexA];
1561 _WordType sumPlatformB = rhsPlatforms[indexB];
1562 while (indexA < numA && indexB < numB) {
1563 if (op(bitA, bitB)) {
1567 if (sumPlatformA < sumPlatformB) {
1570 sumPlatformA += _platforms[indexA];
1572 }
else if (sumPlatformA > sumPlatformB) {
1575 sumPlatformB += rhsPlatforms[indexB];
1583 if (indexA >= numA || indexB >= numB) {
1587 sumPlatformA += _platforms[indexA];
1588 sumPlatformB += rhsPlatforms[indexB];
1599 uint8_t _LinearSearch(
1600 size_t index,
size_t *platformIndex,
size_t *bitCount)
const {
1601 uint8_t bit = _runningBit;
1605 for (i = 0; i < _platforms.GetNum(); ++i) {
1606 count += _platforms[i];
1607 if (count > index) {
1633 _WordArray _platforms;
1640 uint8_t _runningBit;
1644template <TfCompressedBits::Mode mode>
1648 class const_iterator
1651 using iterator_category = std::forward_iterator_tag;
1652 using value_type =
const uint32_t;
1653 using reference =
const uint32_t &;
1654 using pointer =
const uint32_t *;
1655 using difference_type =
const uint32_t;
1665 reference operator*()
const {
return dereference(); }
1666 pointer operator->()
const {
return &(dereference()); }
1668 const_iterator& operator++() {
1673 const_iterator operator++(
int) {
1674 const_iterator r(*
this);
1679 bool operator==(
const const_iterator& rhs)
const {
1683 bool operator!=(
const const_iterator& rhs)
const {
1687 bool IsSet()
const {
1691 bool IsAtEnd()
const {
1695 return _bitIndex >= _bits->GetSize();
1703 uint32_t platformIndex,
1707 _platformIndex(platformIndex),
1708 _bitIndex(bitIndex),
1713 bool equal(
const const_iterator &rhs)
const {
1714 return _bits == rhs._bits && _bitIndex == rhs._bitIndex;
1732 if (_bitCounter >= _bits->_platforms[_platformIndex]) {
1736 const uint32_t numP =
1737 _bits->_platforms.GetNum();
1738 if ((mode == Mode::AllSet || mode == Mode::AllUnset) &&
1739 (_platformIndex + 1) < numP) {
1740 _bitIndex += _bits->_platforms[_platformIndex + 1];
1741 _platformIndex += 2;
1748 _value = 1 - _value;
1756 const uint32_t &dereference()
const {
1761 uint32_t _platformIndex;
1763 uint32_t _bitCounter;
1768 typedef const_iterator iterator;
1770 const_iterator begin()
const {
1771 const uint8_t bit = _bits->_runningBit;
1775 if ((mode == Mode::AllSet && bit == 0) ||
1776 (mode == Mode::AllUnset && bit == 1)) {
1777 return const_iterator(_bits, 1, _bits->_platforms[0], 1 - bit);
1780 return const_iterator(_bits, 0, 0, bit);
1783 const_iterator end()
const {
1784 return const_iterator(_bits, 0, _bits->
GetSize(), 0);
1790 return begin() == end();
1812 class const_iterator
1815 using iterator_category = std::forward_iterator_tag;
1816 using value_type =
const uint32_t;
1817 using reference =
const uint32_t &;
1818 using pointer =
const uint32_t *;
1819 using difference_type =
const uint32_t;
1827 reference operator*()
const {
return dereference(); }
1828 pointer operator->()
const {
return &(dereference()); }
1830 const_iterator& operator++() {
1835 const_iterator operator++(
int) {
1836 const_iterator r(*
this);
1841 bool operator==(
const const_iterator& rhs)
const {
1845 bool operator!=(
const const_iterator& rhs)
const {
1849 bool IsSet()
const {
1853 uint32_t GetPlatformSize()
const {
1861 const uint32_t *platform,
1863 : _platform(platform)
1868 bool equal(
const const_iterator &rhs)
const {
1869 return _platform == rhs._platform;
1873 _bitIndex += *_platform;
1875 _value = 1 - _value;
1878 const uint32_t &dereference()
const {
1882 const uint32_t *_platform;
1887 const_iterator begin()
const {
1888 return const_iterator(_bits->_platforms.Begin(), _bits->_runningBit);
1891 const_iterator end()
const {
1892 return const_iterator(_bits->_platforms.End(), 0);
1898 return begin() == end();
1915TfCompressedBits::GetAllView()
const
1917 return View<Mode::All>(
this);
1921TfCompressedBits::GetAllSetView()
const
1923 return View<Mode::AllSet>(
this);
1927TfCompressedBits::GetAllUnsetView()
const
1929 return View<Mode::AllUnset>(
this);
1933TfCompressedBits::GetPlatformsView()
const
1935 return View<Mode::Platforms>(
this);
1962PXR_NAMESPACE_CLOSE_SCOPE
Provide architecture-specific memory-alignment information.
Low-level utilities for informing users of various internal and external diagnostic conditions.
A simple iterator adapter for STL containers.
Fast bit array that keeps track of the number of bits set and can find the next set in a timely manne...
bool IsEmpty() const
Return true, if the view is empty.
Fast, compressed bit array which is capable of performing logical operations without first decompress...
void ShiftLeft(size_t bits)
Shift this bitset a given number of bits to the left, and extend the right with zeroes.
TfCompressedBits operator<<(size_t bits) const
Returns bits shifted to the left.
void SetAll()
Sets all bits to one.
size_t GetSize() const
Returns the size of the bit array, ie.
size_t FindNextUnset(size_t index) const
Finds the next unset bit that has a higher or equal index than index.
bool Contains(const TfCompressedBits &rhs) const
Returns true if this bit array contains rhs by computing: (rhs - this).GetNumSet() == 0.
bool AreAllSet() const
Returns true, if all the bits in this bit array are set.
size_t GetNumSetPlatforms() const
Returns the number of set (ones) platforms in this bitset.
TfCompressedBits operator&(const TfCompressedBits &rhs) const
Returns these bits and'ed with rhs.
TF_API std::string GetAsStringRightToLeft() const
Returns a string representing the bits for debugging with bits ordered from right to left with increa...
void SetRange(size_t first, size_t last)
Sets the bit within the range of first and last.
bool IsAnySet() const
Returns true, if there is at least a single set bit.
View< Mode::AllSet > AllSetView
Returns an iteratable view for the bits that steps over all set bits.
bool operator==(const TfCompressedBits &rhs) const
Returns true if this == rhs.
TfCompressedBits & operator-=(const TfCompressedBits &rhs)
Removes all bits in the rhs bits from these bits.
size_t FindNthSet(size_t nth) const
Returns the index of the n-th bit set in this bit set.
View< Mode::AllUnset > AllUnsetView
Returns an iteratable view for the bits that steps over all unset bits.
TfCompressedBits(const TfCompressedBits &rhs)
Copy-constructs a fixed size bit array.
void ResizeKeepContents(size_t num)
Resize the bitset, while keeping the contents, unless trimmed.
void Clear(size_t index)
Clears bit # index to zero.
TfCompressedBits operator>>(size_t bits) const
Returns bits shifted to the right.
TfCompressedBits operator-(const TfCompressedBits &rhs) const
Returns bits with all the bits in rhs removed from these bits.
bool AreContiguouslySet() const
Returns true if the set bits in this bit array are contiguous.
void Append(size_t num, bool value)
Append a number of bits with the given value to this bitset.
TfCompressedBits & operator=(const TfCompressedBits &rhs)
Assignment operator.
size_t GetLastSet() const
Returns the index of the last bit set in the bit array.
void Count(size_t *numSet, size_t *maxGap) const
Count the bits set, and also return the largest gap between bits.
void Set(size_t index)
Sets bit # index to zero.
void Assign(size_t index, bool value)
Assigns val to bit # index.
TF_API std::string GetAsStringLeftToRight() const
Returns a string representing the bits for debugging with bits ordered from left to right with increa...
void ShiftRight(size_t bits)
Shift this bitset a given number of bits to the right, and extend to the left with zeroes.
bool IsSet(size_t index) const
Returns true, if bit # index is set.
TfCompressedBits(size_t num=0)
Constructs a fixed size bit array, clears all bits.
TfCompressedBits & operator=(TfCompressedBits &&rhs)
Move assignment operator.
size_t GetNumUnsetPlatforms() const
Returns the number of unset (zeros) platforms in this bitset.
bool IsEmpty() const
Returns true if this bit array is empty, i.e.
TfCompressedBits & operator>>=(size_t bits)
Shifts to the right (see ShiftRight)
size_t GetFirstSet() const
Returns the index of the first bit set in the bit array.
TfCompressedBits & operator^=(const TfCompressedBits &rhs)
Xors these bits with the rhs bits.
void Swap(TfCompressedBits &rhs)
Provides a fast swap.
void ClearAll()
Clears all bits to zero.
bool IsAnyUnset() const
Returns true, if there is at least a single unset bit.
TF_API std::string GetAsRLEString() const
Returns a string representing the bits for debugging with bits represented in run-length encoding for...
TF_API size_t GetHash() const
Returns a hash for this instance.
size_t GetNumPlatforms() const
Returns the number of platforms (zeros or ones) in this bitset.
TfCompressedBits & Complement()
Flips all bits.
TF_API void Decompress(TfBits *bits) const
Decompress the bits into a TfBits array.
size_t GetAllocatedSize() const
Returns the amount of memory this object holds on to.
bool operator!=(const TfCompressedBits &rhs) const
Returns true if this != rhs.
TfCompressedBits & operator|=(const TfCompressedBits &rhs)
Ors these bits with the rhs bits.
TfCompressedBits(TfCompressedBits &&rhs)
Move Constructor.
size_t FindPrevSet(size_t index) const
Finds the next unset bit that has a higher or equal index than index.
TfCompressedBits operator^(const TfCompressedBits &rhs) const
Returns these bits xor'ed with rhs.
bool HasNonEmptyDifference(const TfCompressedBits &rhs) const
Returns true if the result of an asymmetric set different is non-zero.
~TfCompressedBits()
Destructor.
TF_API TfCompressedBits(const TfBits &bits)
Construct a TfCompressedBits array from a TfBits array.
TfCompressedBits & operator&=(const TfCompressedBits &rhs)
Ands these bits with the rhs bits.
TfCompressedBits & operator<<=(size_t bits)
Shifts to the left (see ShiftLeft)
static TF_API TfCompressedBits FromString(const std::string &source)
Returns a bitset constructed from the supplied string representation.
View< Mode::All > AllView
Returns an iteratable view for the bits that steps over all bits.
TfCompressedBits(size_t num, size_t first, size_t last)
Constructs a fixed size bit array, with a range of bits set.
static const TfCompressedBits & GetEmpty()
Returns an empty TfBits.
bool AreAllUnset() const
Returns true, if all the bits in this bit array are unset.
bool HasNonEmptyIntersection(const TfCompressedBits &rhs) const
Returns true if the result of the intersection with rhs would be non-zero.
size_t FindNextSet(size_t index) const
Find the next bit set that is higher or equal to index.
bool operator[](size_t index) const
Returns bit at index.
TfCompressedBits operator|(const TfCompressedBits &rhs) const
Returns these bits or'ed with the rhs.
size_t GetNumSet() const
Returns the number of bits currently set in this array.
ComplementTagType
Copy-construct a fixed sized bit array, from the complement of the rhs bitset.
View< Mode::Platforms > PlatformsView
Returns an iteratable view for the bits that steps over all platforms.
static size_t Combine(Args &&... args)
Produce a hash code by combining the hash codes of several objects.
Create or return a previously created object instance of global data.
#define ARCH_CACHE_LINE_SIZE
The size of a CPU cache line on the current processor architecture in bytes.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
#define TF_VERIFY(cond, format,...)
Checks a condition and reports an error if it evaluates false.
A hash functor for TfCompressedBits that is faster than Hash.
Hash for TfCompressedBits.