diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2019-01-22 21:46:14 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:08:14 +0300 |
commit | ed1646ca7412151dbdd81f4e4d05437cc99e9c8c (patch) | |
tree | f07ae3c880a980d75f92c54e40995e04c9aea5f9 /fs/bcachefs/bkey.c | |
parent | 430735cd1a0304195a080f8ee239016444a02715 (diff) | |
download | linux-ed1646ca7412151dbdd81f4e4d05437cc99e9c8c.tar.xz |
bcachefs: Improve c version of __bkey_cmp_bits
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/bkey.c')
-rw-r--r-- | fs/bcachefs/bkey.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/bcachefs/bkey.c b/fs/bcachefs/bkey.c index d35cdde299c4..8a3295ff9631 100644 --- a/fs/bcachefs/bkey.c +++ b/fs/bcachefs/bkey.c @@ -1014,11 +1014,8 @@ static inline int __bkey_cmp_bits(const u64 *l, const u64 *r, nr_key_bits -= 64; } - if (l_v != r_v) - return l_v < r_v ? -1 : 1; - - if (!nr_key_bits) - return 0; + if (!nr_key_bits || l_v != r_v) + break; l = next_word(l); r = next_word(r); @@ -1026,6 +1023,8 @@ static inline int __bkey_cmp_bits(const u64 *l, const u64 *r, l_v = *l; r_v = *r; } + + return (l_v > r_v) - (l_v < r_v); } #endif |