From 384907f4e7790061538f527e3fa68c79d903cfb6 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 8 Jun 2025 19:47:02 +0200 Subject: [PATCH] IMPORT: eb32: drop the now useless node_bit variable This one was previously used to preload from the node and keep a copy in a register on i386 machines with few registers. With the new more optimal code it's totally useless, so let's get rid of it. By the way the 64 bit code didn't use that at all already. This is ebtree commit 1e219a74cfa09e785baf3637b6d55993d88b47ef. --- include/import/eb32tree.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/include/import/eb32tree.h b/include/import/eb32tree.h index 6b52945c5..391fbd662 100644 --- a/include/import/eb32tree.h +++ b/include/import/eb32tree.h @@ -120,7 +120,6 @@ static forceinline struct eb32_node *__eb32_lookup(struct eb_root *root, u32 x) struct eb32_node *node; eb_troot_t *troot; u32 y, z; - int node_bit; troot = root->b[EB_LEFT]; if (unlikely(troot == NULL)) @@ -141,9 +140,8 @@ static forceinline struct eb32_node *__eb32_lookup(struct eb_root *root, u32 x) __builtin_prefetch(node->node.branches.b[0], 0); __builtin_prefetch(node->node.branches.b[1], 0); - node_bit = node->node.bit; y = node->key ^ x; - z = 1U << (node_bit & 31); + z = 1U << (node->node.bit & 31); troot = (x & z) ? node->node.branches.b[1] : node->node.branches.b[0]; if (!y) { @@ -151,7 +149,7 @@ static forceinline struct eb32_node *__eb32_lookup(struct eb_root *root, u32 x) * we have a dup tree. In the later case, we have to * walk it down left to get the first entry. */ - if (node_bit < 0) { + if (node->node.bit < 0) { troot = node->node.branches.b[EB_LEFT]; while (eb_gettag(troot) != EB_LEAF) troot = (eb_untag(troot, EB_NODE))->b[EB_LEFT]; @@ -176,7 +174,6 @@ static forceinline struct eb32_node *__eb32i_lookup(struct eb_root *root, s32 x) eb_troot_t *troot; u32 key = x ^ 0x80000000; u32 y, z; - int node_bit; troot = root->b[EB_LEFT]; if (unlikely(troot == NULL)) @@ -197,9 +194,8 @@ static forceinline struct eb32_node *__eb32i_lookup(struct eb_root *root, s32 x) __builtin_prefetch(node->node.branches.b[0], 0); __builtin_prefetch(node->node.branches.b[1], 0); - node_bit = node->node.bit; y = node->key ^ x; - z = 1U << (node_bit & 31); + z = 1U << (node->node.bit & 31); troot = (key & z) ? node->node.branches.b[1] : node->node.branches.b[0]; if (!y) { @@ -207,7 +203,7 @@ static forceinline struct eb32_node *__eb32i_lookup(struct eb_root *root, s32 x) * we have a dup tree. In the later case, we have to * walk it down left to get the first entry. */ - if (node_bit < 0) { + if (node->node.bit < 0) { troot = node->node.branches.b[EB_LEFT]; while (eb_gettag(troot) != EB_LEAF) troot = (eb_untag(troot, EB_NODE))->b[EB_LEFT];