Adjust loop conditions in VlTriggerVec functions

This change is not a functional one; it is only meant to appease the
compiler with respect to warnings such as GCC's `-Wtype-limits`.

Signed-off-by: Krzysztof Bieganski <[email protected]>
This commit is contained in:
Krzysztof Bieganski
2022-05-25 18:45:59 +01:00
committed by Geza Lore
parent d7a75dc026
commit 3a310f19f0
+4 -3
View File
@@ -76,6 +76,7 @@ extern std::string VL_TO_STRING_W(int words, const WDataInP obj);
template <std::size_t T_size> //
class VlTriggerVec final {
// TODO: static assert T_size > 0, and don't generate when empty
private:
// MEMBERS
std::array<bool, T_size> m_flags; // State of the assoc array
@@ -95,19 +96,19 @@ public:
// Return true iff at least one element is set
bool any() const {
for (size_t i = 0; i < T_size; ++i)
for (size_t i = 0; i < m_flags.size(); ++i)
if (m_flags[i]) return true;
return false;
}
// Set all elements true in 'this' that are set in 'other'
void set(const VlTriggerVec<T_size>& other) {
for (size_t i = 0; i < T_size; ++i) m_flags[i] |= other.m_flags[i];
for (size_t i = 0; i < m_flags.size(); ++i) m_flags[i] |= other.m_flags[i];
}
// Set elements of 'this' to 'a & !b' element-wise
void andNot(const VlTriggerVec<T_size>& a, const VlTriggerVec<T_size>& b) {
for (size_t i = 0; i < T_size; ++i) m_flags[i] = a.m_flags[i] & !b.m_flags[i];
for (size_t i = 0; i < m_flags.size(); ++i) m_flags[i] = a.m_flags[i] & !b.m_flags[i];
}
};