From c0fab438a565cb2134679af8830d11644668d6a2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 20 Nov 2020 17:24:35 -0500 Subject: Bug fixes: Memory leak/off by one on UIntSet (#1616) * #include an absolute path didn't work - because paths were taken to always be relative. * Fix memory leak on ScopedAllocation. Fix off by one bug on UIntSet --- source/core/slang-uint-set.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source/core/slang-uint-set.cpp') diff --git a/source/core/slang-uint-set.cpp b/source/core/slang-uint-set.cpp index 3ac1c530a..02e142706 100644 --- a/source/core/slang-uint-set.cpp +++ b/source/core/slang-uint-set.cpp @@ -64,6 +64,21 @@ void UIntSet::clear() ::memset(m_buffer.getBuffer(), 0, m_buffer.getCount() * sizeof(Element)); } +bool UIntSet::isEmpty() const +{ + const Element*const src = m_buffer.getBuffer(); + const Index count = m_buffer.getCount(); + + for (Index i = 0; i < count; ++i) + { + if (src[i]) + { + return false; + } + } + return true; +} + void UIntSet::clearAndDeallocate() { m_buffer.clearAndDeallocate(); -- cgit v1.2.3