From: Sage Weil Date: Thu, 23 Apr 2015 20:27:43 +0000 (-0700) Subject: hobject_t: restore default comparators ... bitwise! X-Git-Tag: v9.1.0~346^2~67 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f72ba6e862382da536c6c86f5eecd7ffda756015;p=ceph.git hobject_t: restore default comparators ... bitwise! Note that this breaks compatibility for the moment. Signed-off-by: Sage Weil --- diff --git a/src/common/hobject.h b/src/common/hobject.h index b5f8b363abc..ce9f1dd009e 100644 --- a/src/common/hobject.h +++ b/src/common/hobject.h @@ -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,