mirror of
https://github.com/isar/libmdbx.git
synced 2024-10-30 23:39:19 +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; \
|
||||
length >>= 1; \
|
||||
const TYPE_LIST *const middle = first + length; \
|
||||
if (CMP(*middle, item)) { \
|
||||
first = middle + 1; \
|
||||
length = whole - length - 1; \
|
||||
} \
|
||||
const unsigned left = whole - length - 1; \
|
||||
const bool cmp = CMP(*middle, item); \
|
||||
length = cmp ? left : length; \
|
||||
first = cmp ? middle + 1 : first; \
|
||||
} \
|
||||
\
|
||||
switch (length) { \
|
||||
|
Loading…
Reference in New Issue
Block a user