From 654b020bc72d6e2af7905939cdc4aaba1ae2e451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Wed, 27 Jul 2022 17:51:03 +0300 Subject: [PATCH] mdbx: add `__restrict` to quicksort internal pointers. --- src/core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core.c b/src/core.c index 816dd55f..b2acb378 100644 --- a/src/core.c +++ b/src/core.c @@ -2847,11 +2847,12 @@ static int lcklist_detach_locked(MDBX_env *env) { TYPE *lo, *hi; \ } NAME##_stack; \ \ - static __hot void NAME(TYPE *const begin, TYPE *const end) { \ - NAME##_stack stack[sizeof(unsigned) * CHAR_BIT], *top = stack; \ + static __hot void NAME(TYPE *const __restrict begin, \ + TYPE *const __restrict end) { \ + NAME##_stack stack[sizeof(unsigned) * CHAR_BIT], *__restrict top = stack; \ \ - TYPE *hi = end - 1; \ - TYPE *lo = begin; \ + TYPE *__restrict hi = end - 1; \ + TYPE *__restrict lo = begin; \ while (true) { \ const ptrdiff_t len = hi - lo; \ if (len < 16) { \ @@ -2862,7 +2863,7 @@ static int lcklist_detach_locked(MDBX_env *env) { continue; \ } \ \ - TYPE *mid = lo + (len >> 1); \ + TYPE *__restrict mid = lo + (len >> 1); \ SORT_CMP_SWAP(TYPE, CMP, *lo, *mid); \ SORT_CMP_SWAP(TYPE, CMP, *mid, *hi); \ SORT_CMP_SWAP(TYPE, CMP, *lo, *mid); \