diff options
author | Andrew Morrow <acm@10gen.com> | 2013-05-07 15:54:37 -0400 |
---|---|---|
committer | Andrew Morrow <acm@10gen.com> | 2013-05-07 23:34:50 -0400 |
commit | c13d75db43b76a51e96dc61c70fecb75bdaccf70 (patch) | |
tree | ed7918d9cb5bb58ddfaded8633455ce870676c5c /src/mongo | |
parent | 8540c7ffb60c49534779c423e066e1e47d6962c4 (diff) | |
download | mongo-c13d75db43b76a51e96dc61c70fecb75bdaccf70.tar.gz |
Add non-operator variants of bitAnd and bitOr to SafeNum
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/util/safe_num-inl.h | 16 | ||||
-rw-r--r-- | src/mongo/util/safe_num.h | 2 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/mongo/util/safe_num-inl.h b/src/mongo/util/safe_num-inl.h index 80ece09d56d..1dc1dcbe785 100644 --- a/src/mongo/util/safe_num-inl.h +++ b/src/mongo/util/safe_num-inl.h @@ -60,20 +60,28 @@ namespace mongo { return *this = addInternal(*this, rhs); } - inline SafeNum SafeNum::operator&(const SafeNum& rhs) const { + inline SafeNum SafeNum::bitAnd(const SafeNum& rhs) const { return andInternal(*this, rhs); } + inline SafeNum SafeNum::operator&(const SafeNum& rhs) const { + return bitAnd(rhs); + } + inline SafeNum& SafeNum::operator&=(const SafeNum& rhs) { - return *this = andInternal(*this, rhs); + return *this = bitAnd(rhs); } - inline SafeNum SafeNum::operator|(const SafeNum& rhs) const { + inline SafeNum SafeNum::bitOr(const SafeNum& rhs) const { return orInternal(*this, rhs); } + inline SafeNum SafeNum::operator|(const SafeNum& rhs) const { + return bitOr(rhs); + } + inline SafeNum& SafeNum::operator|=(const SafeNum& rhs) { - return *this = orInternal(*this, rhs); + return *this = bitOr(rhs); } inline bool SafeNum::isValid() const { diff --git a/src/mongo/util/safe_num.h b/src/mongo/util/safe_num.h index 1d4782fe774..6e13225766e 100644 --- a/src/mongo/util/safe_num.h +++ b/src/mongo/util/safe_num.h @@ -112,10 +112,12 @@ namespace mutablebson { // // Bitwise 'and' support + SafeNum bitAnd(const SafeNum& rhs) const; SafeNum operator&(const SafeNum& rhs) const; SafeNum& operator&=(const SafeNum& rhs); // Bitwise 'or' support + SafeNum bitOr(const SafeNum& rhs) const; SafeNum operator|(const SafeNum& rhs) const; SafeNum& operator|=(const SafeNum& rhs); |