From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 1/2] eal: add RTE_MIN4 and RTE_MAX4 macros
Date: Wed, 11 Mar 2026 17:20:26 -0700 [thread overview]
Message-ID: <20260312002123.867357-2-stephen@networkplumber.org> (raw)
In-Reply-To: <20260312002123.867357-1-stephen@networkplumber.org>
These are analogous to the existing RTE_MIN3 macros and allow
drivers to take compute minimum of four values without invoking
the shadow warning gods.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/include/rte_common.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index 573bf4f2ce..79364170d6 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -812,6 +812,16 @@ __extension__ typedef uint64_t RTE_MARKER64[0];
(_b_min3 < _c_min3 ? _b_min3 : _c_min3); \
})
+/**
+ * Macro to return the minimum of four numbers
+ */
+#define RTE_MIN4(a, b, c, d) \
+ __extension__ ({ \
+ typeof (a) _min4_ab = RTE_MIN((a), (b)); \
+ typeof (c) _min4_cd = RTE_MIN((c), (d)); \
+ RTE_MIN(_min4_ab, _min4_cd); \
+ })
+
/**
* Macro to return the minimum of two numbers
*
@@ -845,6 +855,16 @@ __extension__ typedef uint64_t RTE_MARKER64[0];
(_b_max3 > _c_max3 ? _b_max3 : _c_max3); \
})
+/**
+ * Macro to return the maximum of four numbers
+ */
+#define RTE_MAX4(a, b, c, d) \
+ __extension__ ({ \
+ typeof (a) _max4_ab = RTE_MAX((a), (b)); \
+ typeof (c) _max4_cd = RTE_MAX((c), (d)); \
+ RTE_MAX(_max4_ab, _max4_cd); \
+ })
+
/**
* Macro to return the maximum of two numbers
*
--
2.51.0
next prev parent reply other threads:[~2026-03-12 0:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 0:20 [PATCH 0/2] net/bnxt: shadow variable warnings Stephen Hemminger
2026-03-12 0:20 ` Stephen Hemminger [this message]
2026-03-12 0:20 ` [PATCH 2/2] net/bnxt: fix " Stephen Hemminger
2026-03-12 22:46 ` Kishore Padmanabha
2026-03-17 8:02 ` Thomas Monjalon
2026-03-18 3:16 ` 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=20260312002123.867357-2-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
/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