]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
hobject_t: restore default comparators ... bitwise!
authorSage Weil <sage@redhat.com>
Thu, 23 Apr 2015 20:27:43 +0000 (13:27 -0700)
committerSage Weil <sage@redhat.com>
Fri, 7 Aug 2015 14:16:00 +0000 (10:16 -0400)
Note that this breaks compatibility for the moment.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/hobject.h

index b5f8b363abcef24fc9bfd7203bbbc49c1a21bf38..ce9f1dd009e35960c43a82fac9a4f968563775d7 100644 (file)
@@ -289,6 +289,18 @@ CEPH_HASH_NAMESPACE_END
 ostream& operator<<(ostream& out, const hobject_t& o);
 
 WRITE_EQ_OPERATORS_7(hobject_t, hash, oid, get_key(), snap, pool, max, nspace)
+static inline bool operator<(const hobject_t& l, const hobject_t& r) {
+  return cmp_bitwise(l, r) < 0;
+}
+static inline bool operator<=(const hobject_t& l, const hobject_t& r) {
+  return cmp_bitwise(l, r) <= 0;
+}
+static inline bool operator>(const hobject_t& l, const hobject_t& r) {
+  return cmp_bitwise(l, r) > 0;
+}
+static inline bool operator>=(const hobject_t& l, const hobject_t& r) {
+  return cmp_bitwise(l, r) >= 0;
+}
 
 extern int cmp_nibblewise(const hobject_t& l, const hobject_t& r);
 extern int cmp_bitwise(const hobject_t& l, const hobject_t& r);
@@ -430,6 +442,19 @@ ostream& operator<<(ostream& out, const ghobject_t& o);
 
 WRITE_EQ_OPERATORS_4(ghobject_t, max, shard_id, hobj, generation)
 
+static inline bool operator<(const ghobject_t& l, const ghobject_t& r) {
+  return cmp_bitwise(l, r) < 0;
+}
+static inline bool operator<=(const ghobject_t& l, const ghobject_t& r) {
+  return cmp_bitwise(l, r) <= 0;
+}
+static inline bool operator>(const ghobject_t& l, const ghobject_t& r) {
+  return cmp_bitwise(l, r) > 0;
+}
+static inline bool operator>=(const ghobject_t& l, const ghobject_t& r) {
+  return cmp_bitwise(l, r) >= 0;
+}
+
 extern int cmp_nibblewise(const ghobject_t& l, const ghobject_t& r);
 extern int cmp_bitwise(const ghobject_t& l, const ghobject_t& r);
 static inline int cmp(const ghobject_t& l, const ghobject_t& r,