From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: "Stephen Hemminger" <stephen@networkplumber.org>,
"Morten Brørup" <mb@smartsharesystems.com>,
"Yipeng Wang" <yipeng1.wang@intel.com>,
"Sameh Gobriel" <sameh.gobriel@intel.com>,
"Bruce Richardson" <bruce.richardson@intel.com>,
"Vladimir Medvedkin" <vladimir.medvedkin@intel.com>
Subject: [PATCH v4 2/4] hash: use static_assert
Date: Tue, 16 Sep 2025 08:00:45 -0700 [thread overview]
Message-ID: <20250916150219.104936-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20250916150219.104936-1-stephen@networkplumber.org>
Now that static_assert is available, better than pre-processor
use of #if condition.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
lib/hash/rte_cuckoo_hash.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/hash/rte_cuckoo_hash.h b/lib/hash/rte_cuckoo_hash.h
index 16fe999c4c..90fda7d7e0 100644
--- a/lib/hash/rte_cuckoo_hash.h
+++ b/lib/hash/rte_cuckoo_hash.h
@@ -24,9 +24,8 @@
*/
#define RTE_HASH_BUCKET_ENTRIES 8
-#if !RTE_IS_POWER_OF_2(RTE_HASH_BUCKET_ENTRIES)
-#error RTE_HASH_BUCKET_ENTRIES must be a power of 2
-#endif
+static_assert(RTE_IS_POWER_OF_2(RTE_HASH_BUCKET_ENTRIES),
+ "RTE_HASH_BUCKET_ENTRIES must be a power of 2");
#define NULL_SIGNATURE 0
--
2.47.3
next prev parent reply other threads:[~2025-09-16 15:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0250818233102.180207-1-stephen@networkplumber.org>
2025-09-16 15:00 ` [PATCH v4 0/4] Cuckoo hash optimization for small sizes Stephen Hemminger
2025-09-16 15:00 ` [PATCH v4 1/4] hash: move table of hash compare functions out of header Stephen Hemminger
2025-09-16 15:00 ` Stephen Hemminger [this message]
2025-09-16 15:00 ` [PATCH v4 3/4] hash: reduce architecture special cases Stephen Hemminger
2025-09-16 15:00 ` [PATCH v4 4/4] hash: add support for common small key sizes Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250916150219.104936-3-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
--cc=sameh.gobriel@intel.com \
--cc=vladimir.medvedkin@intel.com \
--cc=yipeng1.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).