aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-08-11 18:54:06 +0200
committerDavid Robillard <d@drobilla.net>2018-09-29 14:46:19 +0200
commitfdcdfdc94293f8259f082081a11fc004fc5f8fc9 (patch)
tree48be1834a1a9e9b3c334c3bb5942b2d97f34e64d
parent7c4a75add8ee00eb791aa074e84c608c9bcf7c5f (diff)
downloadchilbert-fdcdfdc94293f8259f082081a11fc004fc5f8fc9.tar.gz
chilbert-fdcdfdc94293f8259f082081a11fc004fc5f8fc9.tar.bz2
chilbert-fdcdfdc94293f8259f082081a11fc004fc5f8fc9.zip
Add equality operators
-rw-r--r--chilbert/BigBitVec.hpp10
-rw-r--r--chilbert/FixBitVec.hpp10
2 files changed, 20 insertions, 0 deletions
diff --git a/chilbert/BigBitVec.hpp b/chilbert/BigBitVec.hpp
index 7a1b49a..aa8e7e1 100644
--- a/chilbert/BigBitVec.hpp
+++ b/chilbert/BigBitVec.hpp
@@ -104,6 +104,16 @@ public:
return *this;
}
+ bool operator==(const CBigBitVec& vec) const
+ {
+ return (
+ rackCount() == vec.rackCount() &&
+ (rackCount() == 0 ||
+ !memcmp(racks(), vec.racks(), rackCount() * sizeof(FBV_UINT))));
+ }
+
+ bool operator!=(const CBigBitVec& vec) const { return !(*this == vec); }
+
/// Non-resizing assignment
CBigBitVec& operator=(const CBigBitVec& vec)
{
diff --git a/chilbert/FixBitVec.hpp b/chilbert/FixBitVec.hpp
index ac02e40..05af40e 100644
--- a/chilbert/FixBitVec.hpp
+++ b/chilbert/FixBitVec.hpp
@@ -96,6 +96,16 @@ public:
return *this;
}
+ bool operator==(const CFixBitVec& vec) const
+ {
+ return m_rack == vec.m_rack;
+ }
+
+ bool operator!=(const CFixBitVec& vec) const
+ {
+ return m_rack != vec.m_rack;
+ }
+
CFixBitVec& operator=(const FBV_UINT i)
{
m_rack = i;