From ac886fd3e329a9599ed1ac7a6d8b26ca5821046c Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 4 Oct 2023 11:20:35 -0700 Subject: SPIRV compiler performance fixes. (#3258) * SPIRV compiler performance fixes. * Cleanup. * update project files * Cleanup debug code. * Make redundancy removal non-recursive. --------- Co-authored-by: Yong He --- source/core/slang-uint-set.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'source/core') diff --git a/source/core/slang-uint-set.h b/source/core/slang-uint-set.h index f2c573865..4912ae504 100644 --- a/source/core/slang-uint-set.h +++ b/source/core/slang-uint-set.h @@ -52,6 +52,8 @@ public: /// Returns true if the value is present inline bool contains(UInt val) const; + inline bool contains(const UIntSet& set) const; + /// == bool operator==(const UIntSet& set) const; /// != @@ -110,6 +112,25 @@ inline bool UIntSet::contains(UInt val) const ((m_buffer[idx] & (Element(1) << (val & kElementMask))) != 0); } +// -------------------------------------------------------------------------- +inline bool UIntSet::contains(const UIntSet& set) const +{ + for (Index i = 0; i < set.m_buffer.getCount(); i++) + { + if (i >= m_buffer.getCount()) + { + if (set.m_buffer[i]) + return false; + } + else + { + if ((m_buffer[i] & set.m_buffer[i]) != set.m_buffer[i]) + return false; + } + } + return true; +} + // -------------------------------------------------------------------------- inline void UIntSet::add(UInt val) { -- cgit v1.2.3