mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 19:04:12 +08:00
mdbx: refine SEARCH_IMPL macro.
Change-Id: I975e480c047b88e0200aaf889334e8b83ab760ad
This commit is contained in:
parent
0714c07e28
commit
8214d674be
@ -2493,13 +2493,13 @@ static int lcklist_detach_locked(MDBX_env *env) {
|
|||||||
TYPE_LIST *const begin = first, *const end = begin + length; \
|
TYPE_LIST *const begin = first, *const end = begin + length; \
|
||||||
\
|
\
|
||||||
while (length > 3) { \
|
while (length > 3) { \
|
||||||
const unsigned half = length >> 1; \
|
const unsigned whole = length; \
|
||||||
TYPE_LIST *const middle = first + half; \
|
length >>= 1; \
|
||||||
|
TYPE_LIST *const middle = first + length; \
|
||||||
if (CMP(*middle, item)) { \
|
if (CMP(*middle, item)) { \
|
||||||
first = middle + 1; \
|
first = middle + 1; \
|
||||||
length -= half + 1; \
|
length = whole - length - 1; \
|
||||||
} else \
|
} \
|
||||||
length = half; \
|
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
switch (length) { \
|
switch (length) { \
|
||||||
@ -2507,17 +2507,21 @@ static int lcklist_detach_locked(MDBX_env *env) {
|
|||||||
if (!CMP(*first, item)) \
|
if (!CMP(*first, item)) \
|
||||||
break; \
|
break; \
|
||||||
++first; \
|
++first; \
|
||||||
/* fall through */ \
|
__fallthrough /* fall through */; \
|
||||||
__fallthrough; \
|
|
||||||
case 2: \
|
case 2: \
|
||||||
if (!CMP(*first, item)) \
|
if (!CMP(*first, item)) \
|
||||||
break; \
|
break; \
|
||||||
++first; \
|
++first; \
|
||||||
/* fall through */ \
|
__fallthrough /* fall through */; \
|
||||||
__fallthrough; \
|
|
||||||
case 1: \
|
case 1: \
|
||||||
if (CMP(*first, item)) \
|
if (!CMP(*first, item)) \
|
||||||
++first; \
|
break; \
|
||||||
|
++first; \
|
||||||
|
__fallthrough /* fall through */; \
|
||||||
|
case 0: \
|
||||||
|
break; \
|
||||||
|
default: \
|
||||||
|
__unreachable(); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (mdbx_audit_enabled()) { \
|
if (mdbx_audit_enabled()) { \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user