diff mbox series

[v5,1/9] eal: introduce macros for getting value for bit

Message ID 20200709073452.948894-2-parav@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers show
Series Improve mlx5 PMD driver framework for multiple classes | expand


Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Parav Pandit July 9, 2020, 7:34 a.m. UTC
There are several drivers which duplicate bit generation macro.
Introduce a generic bit macros so that such drivers avoid redefining
same in multiple drivers.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
 - Addressed comments from Morten Brørup
 - Renamed newly added macro to RTE_BIT64
 - Added doxygen comment section for the macro
 - Addressed comments from Thomas and Gaten.
 - Avoided new file, added macro to rte_bitops.h
 lib/librte_eal/include/rte_bitops.h | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series


diff --git a/lib/librte_eal/include/rte_bitops.h b/lib/librte_eal/include/rte_bitops.h
index 740927f3b..ca46a110f 100644
--- a/lib/librte_eal/include/rte_bitops.h
+++ b/lib/librte_eal/include/rte_bitops.h
@@ -17,6 +17,14 @@ 
 #include <rte_debug.h>
 #include <rte_compat.h>
+ * Get the uint64_t value for a specified bit set.
+ *
+ * @param nr
+ *   The bit number in range of 0 to 63.
+ */
+#define RTE_BIT64(nr) (UINT64_C(1) << (nr))
 /*------------------------ 32-bit relaxed operations ------------------------*/