mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 23:14:12 +08:00
mdbx: avoid branches inside bsearch()
loop.
Related for https://github.com/erthink/libmdbx/issues/132 Change-Id: Ia843556cc7052e5081a98f56b43fd80e2d0a40c7
This commit is contained in:
parent
28bd5d81d2
commit
88bdf4b96f
@ -2698,10 +2698,10 @@ static int lcklist_detach_locked(MDBX_env *env) {
|
|||||||
const unsigned whole = length; \
|
const unsigned whole = length; \
|
||||||
length >>= 1; \
|
length >>= 1; \
|
||||||
const TYPE_LIST *const middle = first + length; \
|
const TYPE_LIST *const middle = first + length; \
|
||||||
if (CMP(*middle, item)) { \
|
const unsigned left = whole - length - 1; \
|
||||||
first = middle + 1; \
|
const bool cmp = CMP(*middle, item); \
|
||||||
length = whole - length - 1; \
|
length = cmp ? left : length; \
|
||||||
} \
|
first = cmp ? middle + 1 : first; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
switch (length) { \
|
switch (length) { \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user