Commit ed1646ca authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Improve c version of __bkey_cmp_bits

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 430735cd
...@@ -1014,11 +1014,8 @@ static inline int __bkey_cmp_bits(const u64 *l, const u64 *r, ...@@ -1014,11 +1014,8 @@ static inline int __bkey_cmp_bits(const u64 *l, const u64 *r,
nr_key_bits -= 64; nr_key_bits -= 64;
} }
if (l_v != r_v) if (!nr_key_bits || l_v != r_v)
return l_v < r_v ? -1 : 1; break;
if (!nr_key_bits)
return 0;
l = next_word(l); l = next_word(l);
r = next_word(r); r = next_word(r);
...@@ -1026,6 +1023,8 @@ static inline int __bkey_cmp_bits(const u64 *l, const u64 *r, ...@@ -1026,6 +1023,8 @@ static inline int __bkey_cmp_bits(const u64 *l, const u64 *r,
l_v = *l; l_v = *l;
r_v = *r; r_v = *r;
} }
return (l_v > r_v) - (l_v < r_v);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment