summaryrefslogtreecommitdiff
path: root/source/core/slang-uint-set.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/core/slang-uint-set.cpp')
-rw-r--r--source/core/slang-uint-set.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/source/core/slang-uint-set.cpp b/source/core/slang-uint-set.cpp
index ba71254e1..457915449 100644
--- a/source/core/slang-uint-set.cpp
+++ b/source/core/slang-uint-set.cpp
@@ -3,6 +3,27 @@
namespace Slang
{
+Index UIntSet::getLSBZero()
+{
+ uint64_t offset = 0;
+ for (Element& element : this->m_buffer)
+ {
+ // Flip all bits so bitscanForward can find a 0 bit
+ Element flippedElement = ~element;
+
+ // continue if we don't have 0 bits
+ if (flippedElement == 0)
+ {
+ offset += sizeof(Element) * 8;
+ continue;
+ }
+
+ // Get LSBZero of current Block, add with offset
+ return bitscanForward(flippedElement) + offset;
+ }
+ return offset;
+}
+
UIntSet& UIntSet::operator=(UIntSet&& other)
{
m_buffer = _Move(other.m_buffer);