From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A4D4543F3A; Tue, 30 Apr 2024 12:06:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 23BCB402C0; Tue, 30 Apr 2024 12:05:57 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2045.outbound.protection.outlook.com [40.107.20.45]) by mails.dpdk.org (Postfix) with ESMTP id 92F6240262 for ; Tue, 30 Apr 2024 12:05:54 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PqgEB8LjW0yxSLfGbEUdvVk5O+X47PWk3ia88gBav+Wn4NG8eW7XdB8y4jeLZpMhDrpXQ4A9TRblCtfJ2Q7zX3o/aNtwc6KrhADqPaiXlsoBWb7xnxv/uEPk6TrPqZnKjc5RR1wGHWl7SZ+p3tyN1jq2e50/xljAUCt/507yB/npKugbg4cXennUtrat+78y3LkdE55Yjbpk7fCij4UbWNhPmf0oSxRt97UVjYRM146cipTb7KRPCQnpsefTwbrhDsz+dUcHowHKOs6bgFBuGb3HeziYxunOlEK4vGJZQ5mly90pN1I4I/qOg1xWDjm6Ww5lJWl+zqob8FXWi2xcJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=f5HAbuFsAhlunqLGlzVjT0YEbYgMjTahD6lsx+VsdgU=; b=GIJpdElGdN6ic7nPIJ7qbtQM8TBPu/kjCGzWihVv/MApKRCp1Ialq2khvRZq4LAxnoSLZYncygEmONg1fouB2r/PZEOyxAlAGaH7SJG7KSdogKCvGs8jJtsPSy7N/5h0CArRPUFwrmgMEP34IRu/PucP01dMr3g0JVlakizyf+PSeVKwWZwWrR/NiBxPXP/fgVVna+YJuekjCmtxpEcwNzbZgtDdRLDx9lAwxGyaV70jfBXaC6bzJ9yuBVR1icO5gSoIAGy40cLFC3PU2o5epjCjZXnpYRMKWtpoo6SnXQH8ZSyG6Q43ryKnPpdp2A9lksFXSOo9DCcGzExW63XVFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=dpdk.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=f5HAbuFsAhlunqLGlzVjT0YEbYgMjTahD6lsx+VsdgU=; b=d5FOXNE4wAPEwC5Bk4nnyNcOnu7X0oD6Vi5E/lNdd1XfqZAt9Q60Cr4ZWOIiFcbByUw/ocDz8rmpgBkEtJ9x36Qc97O07+xZ1SKa5Umkc1NaXnIHcOwkCWDj6Xxq9j5+rLHOENLr0difdibG2Vab7NU4rcVs4Nn8fdHw8Qe5ews5HxrUiIHDXcvJFz8GnsA3LLfGRr/hT6KTR/5SrUH4Z+c+l+rIwzTJA6d9Iz7YetR5wbLbBniMjJ7IFN7hnP76MD+k6xLzzEh3aESQ0XIWxqvOoRJGDsSvRGaitGsLh/xwNr8i7FlIW/OCIGM8y4JG0lYYekJBsYzySuKiWmpvBg== Received: from DUZPR01CA0073.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c2::11) by DBAPR07MB6981.eurprd07.prod.outlook.com (2603:10a6:10:17e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36; Tue, 30 Apr 2024 10:05:53 +0000 Received: from DB1PEPF000509F8.eurprd02.prod.outlook.com (2603:10a6:10:3c2:cafe::1e) by DUZPR01CA0073.outlook.office365.com (2603:10a6:10:3c2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.31 via Frontend Transport; Tue, 30 Apr 2024 10:05:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by DB1PEPF000509F8.mail.protection.outlook.com (10.167.242.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Tue, 30 Apr 2024 10:05:52 +0000 Received: from seliicinfr00050.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.63) with Microsoft SMTP Server id 15.2.1544.9; Tue, 30 Apr 2024 12:05:52 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id 06B1A1C006A; Tue, 30 Apr 2024 12:05:52 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: CC: , Heng Wang , "Stephen Hemminger" , Tyler Retzlaff , =?UTF-8?q?Morten=20Br=C3=B8rup?= , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Subject: [RFC v4 1/6] eal: extend bit manipulation functionality Date: Tue, 30 Apr 2024 11:55:18 +0200 Message-ID: <20240430095523.108688-2-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240430095523.108688-1-mattias.ronnblom@ericsson.com> References: <20240429095138.106849-2-mattias.ronnblom@ericsson.com> <20240430095523.108688-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509F8:EE_|DBAPR07MB6981:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e435264-047e-47d7-54b2-08dc68fd1e99 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|376005|82310400014|36860700004; X-Microsoft-Antispam-Message-Info: =?utf-8?B?a0c3aThZdlRyZEJWSTBpUDNpU3RSdVRVeVBsUUlCRC9RWnNkM0RzWkQwVkhD?= =?utf-8?B?MVVRZVlnQVFVL3lVVXJJbzM5UW1MR2d5YWNoZlBOZ3loNjI0TWNlS0c1U09P?= =?utf-8?B?bVlBRG1vVk1rQmtmQmJHeXg1bFlyVmlMRGlDUkNLWStJa2FMbDJqZS9GeVYy?= =?utf-8?B?cTJ3RzRYbGduOTE4M1d2MEJucFhJMXZWM2d6U2dPcnY2bktYL1NGTmVOaDBD?= =?utf-8?B?ZTZpVU9nYldCcWVjTVhER0ZqSDRSZm5PSkMwWFhNNThXZWNwQ2s4MGkyeVRI?= =?utf-8?B?U01xNHB3T3ZSSHg4UXVScHVEZHBUUVFwQXdVZzgvaERlMktUOEJWby9XNWhj?= =?utf-8?B?OWovM1dWZHRxdjQzaE5JSC9CRHpNaGI0TGJPUHRqZWQxbS9BL3lVUk9TNTM3?= =?utf-8?B?Yk9FaE4vU09kRXZ4YlFmNEtiVnVLZnJ4djFQS0I0Tmt6Wnk0b1BTNWxnQ1dx?= =?utf-8?B?YVBQb2dvbHhJVmlxd1d6cEQvdXpCWkl5NUtoUFFtbk8xNW9yeTB0RTNwWDJX?= =?utf-8?B?cTh0Q2gyQUN2OTA0aGdqMGtINXg2ZERXeTZtQnRxK3VZWlpVUE45STFaUk0y?= =?utf-8?B?U09YY2dVQWpPOVVydGw0T0N1ZkV5MnlpM1ZVSXdrZWR5SmFVaVk3WEN6OFo5?= =?utf-8?B?TlF6S3g5ZEMraVJWUkpvbm9rRm12Q1FWSmtlKzc4b3kydzBacnh3TlRIb29N?= =?utf-8?B?U1VCVzBPdGRQL2lrMTdsbGIzT1Y2OHBlRUJpZmkrcDF3K2d1UTRVWlhrUEU1?= =?utf-8?B?S1QyTUpLb29DN3M1Wk1QS1NKdnovMDk2MVUweDlnaWw1cVd0Vld1dUR4YnRh?= =?utf-8?B?Szc4cjFVd1c0VkFTWklkQzVFL0tPRWFMZmJMQnVLcEllOWRUdERmRGJ3Zis4?= =?utf-8?B?TzJhdi9uTnd4czV5MzYxalVnaXVoRWtjaURnTjdwcG1abWhlOU5JdnFuUFcx?= =?utf-8?B?NnY2c1ZVNkNOOGcranFuZDBHbTMzSDc4VmNLWnVtd2M0TVlhRTJMVE5sejhX?= =?utf-8?B?OUwvY2hDN3RyWDhOUjRIT1FnR1BuZkJQSkFDQ3k5SjlaQXQ1dnRHd0d1MVpC?= =?utf-8?B?TmxrZzd5YTE3dlAwSk5na2RPbENGbExCNmZHeGxpS0NhN3dmTlVnZGI5dkda?= =?utf-8?B?LzdBS3JRbDlYZ3ovcXU3Q0NCL3NTRjRmRDJrMTlCMTgrVlNYY2lvVjc2eDYw?= =?utf-8?B?bUlLaEVENTJUKzJZejlNZURXOHlpL2tzSTdHZzkyN1BmYlR1OERwZ1FGS1Z0?= =?utf-8?B?Q2VpbVpZTUczOEt5cytkdlJWWDJpMk1LVm4vKzB3RnJ2YmNYQ1Fob1Rmb0Y5?= =?utf-8?B?S0ZBOTg4MHc5WTN4R3kxekR0OWdDNmZHOHJXdlJ6VXFhUmJEbm8yNGhwMGtV?= =?utf-8?B?OW9leGwvRFprS2hVZGV2NE5aS0M3dDd0dC8vTFd3S0VIQ3NZMlpiNjY4U0NU?= =?utf-8?B?cU5nNVJSVG9rd2pCazdtckpjVjRxSDVPTmVKd2piTWpJaVBPYXMxUFFYZURj?= =?utf-8?B?dHpzSFdiVmc0dHN1N3NadU03WWZZUm0zZGtjcWNGODYvUjBwS1BPblQzMHhC?= =?utf-8?B?c3RER25hRGNUdmlXL3ppa2p4c3F3SzJrQ0RCdm5VdENRVXZBNjZMcmcyU29V?= =?utf-8?B?ZVNOVEIyRGxIVUhFTkd0Ym82V3Bid1lWUTJBSGZZdXdnLzBxZEJqcGc4MnBz?= =?utf-8?B?WUJBa2tZTVVuT2VxSXJYK1E0SnAyRWk2OVZCcnB0TElpRG5JNjhnZWp3K05S?= =?utf-8?B?L2Mwei95cVFWRU5kNzg3dW1tVU4veGkraitZREVwdFBxZTI5ZkgydjBPcGc2?= =?utf-8?B?akw3aWJUM0JtWjRvWXYrVzk1V01hSHdleEJBNXE3Vy9ENlFRN3JWQ2ZmcWRs?= =?utf-8?Q?EnU9XV6cg+EjS?= X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230031)(1800799015)(376005)(82310400014)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2024 10:05:52.8366 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e435264-047e-47d7-54b2-08dc68fd1e99 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF000509F8.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR07MB6981 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add functionality to test, set, clear, and assign the value to individual bits in 32-bit or 64-bit words. These functions have no implications on memory ordering, atomicity and does not use volatile and thus does not prevent any compiler optimizations. RFC v4: * Add rte_bit_flip() which, believe it or not, flips the value of a bit. * Mark macro-generated private functions as experimental. * Use macros to generate *assign*() functions. RFC v3: * Work around lack of C++ support for _Generic (Tyler Retzlaff). * Fix ','-related checkpatch warnings. Signed-off-by: Mattias Rönnblom Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- lib/eal/include/rte_bitops.h | 257 ++++++++++++++++++++++++++++++++++- 1 file changed, 255 insertions(+), 2 deletions(-) diff --git a/lib/eal/include/rte_bitops.h b/lib/eal/include/rte_bitops.h index 449565eeae..9d426f1602 100644 --- a/lib/eal/include/rte_bitops.h +++ b/lib/eal/include/rte_bitops.h @@ -2,6 +2,7 @@ * Copyright(c) 2020 Arm Limited * Copyright(c) 2010-2019 Intel Corporation * Copyright(c) 2023 Microsoft Corporation + * Copyright(c) 2024 Ericsson AB */ #ifndef _RTE_BITOPS_H_ @@ -11,12 +12,14 @@ * @file * Bit Operations * - * This file defines a family of APIs for bit operations - * without enforcing memory ordering. + * This file provides functionality for low-level, single-word + * arithmetic and bit-level operations, such as counting or + * setting individual bits. */ #include +#include #include #ifdef __cplusplus @@ -105,6 +108,194 @@ extern "C" { #define RTE_FIELD_GET64(mask, reg) \ ((typeof(mask))(((reg) & (mask)) >> rte_ctz64(mask))) +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Test bit in word. + * + * Generic selection macro to test the value of a bit in a 32-bit or + * 64-bit word. The type of operation depends on the type of the @c + * addr parameter. + * + * This macro does not give any guarantees in regards to memory + * ordering or atomicity. + * + * @param addr + * A pointer to the word to modify. + * @param nr + * The index of the bit. + */ +#define rte_bit_test(addr, nr) \ + _Generic((addr), \ + uint32_t *: __rte_bit_test32, \ + uint64_t *: __rte_bit_test64)(addr, nr) + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Set bit in word. + * + * Generic selection macro to set a bit in a 32-bit or 64-bit + * word. The type of operation depends on the type of the @c addr + * parameter. + * + * This macro does not give any guarantees in regards to memory + * ordering or atomicity. + * + * @param addr + * A pointer to the word to modify. + * @param nr + * The index of the bit. + */ +#define rte_bit_set(addr, nr) \ + _Generic((addr), \ + uint32_t *: __rte_bit_set32, \ + uint64_t *: __rte_bit_set64)(addr, nr) + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Clear bit in word. + * + * Generic selection macro to clear a bit in a 32-bit or 64-bit + * word. The type of operation depends on the type of the @c addr + * parameter. + * + * This macro does not give any guarantees in regards to memory + * ordering or atomicity. + * + * @param addr + * A pointer to the word to modify. + * @param nr + * The index of the bit. + */ +#define rte_bit_clear(addr, nr) \ + _Generic((addr), \ + uint32_t *: __rte_bit_clear32, \ + uint64_t *: __rte_bit_clear64)(addr, nr) + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Assign a value to a bit in word. + * + * Generic selection macro to assign a value to a bit in a 32-bit or 64-bit + * word. The type of operation depends on the type of the @c addr parameter. + * + * This macro does not give any guarantees in regards to memory + * ordering or atomicity. + * + * @param addr + * A pointer to the word to modify. + * @param nr + * The index of the bit. + * @param value + * The new value of the bit - true for '1', or false for '0'. + */ +#define rte_bit_assign(addr, nr, value) \ + _Generic((addr), \ + uint32_t *: __rte_bit_assign32, \ + uint64_t *: __rte_bit_assign64)(addr, nr, value) + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Flip a bit in word. + * + * Generic selection macro to change the value of a bit to '0' if '1' + * or '1' if '0' in a 32-bit or 64-bit word. The type of operation + * depends on the type of the @c addr parameter. + * + * This macro does not give any guarantees in regards to memory + * ordering or atomicity. + * + * @param addr + * A pointer to the word to modify. + * @param nr + * The index of the bit. + */ +#define rte_bit_flip(addr, nr) \ + _Generic((addr), \ + uint32_t *: __rte_bit_flip32, \ + uint64_t *: __rte_bit_flip64)(addr, nr) + +#define __RTE_GEN_BIT_TEST(family, fun, qualifier, size) \ + __rte_experimental \ + static inline bool \ + __rte_bit_ ## family ## fun ## size(const qualifier uint ## size ## _t *addr, \ + unsigned int nr) \ + { \ + RTE_ASSERT(nr < size); \ + \ + uint ## size ## _t mask = (uint ## size ## _t)1 << nr; \ + return *addr & mask; \ + } + +#define __RTE_GEN_BIT_SET(family, fun, qualifier, size) \ + __rte_experimental \ + static inline void \ + __rte_bit_ ## family ## fun ## size(qualifier uint ## size ## _t *addr, \ + unsigned int nr) \ + { \ + RTE_ASSERT(nr < size); \ + \ + uint ## size ## _t mask = (uint ## size ## _t)1 << nr; \ + *addr |= mask; \ + } \ + +#define __RTE_GEN_BIT_CLEAR(family, fun, qualifier, size) \ + __rte_experimental \ + static inline void \ + __rte_bit_ ## family ## fun ## size(qualifier uint ## size ## _t *addr, \ + unsigned int nr) \ + { \ + RTE_ASSERT(nr < size); \ + \ + uint ## size ## _t mask = ~((uint ## size ## _t)1 << nr); \ + (*addr) &= mask; \ + } \ + +#define __RTE_GEN_BIT_ASSIGN(family, fun, qualifier, size) \ + __rte_experimental \ + static inline void \ + __rte_bit_ ## family ## fun ## size(qualifier uint ## size ## _t *addr, \ + unsigned int nr, bool value) \ + { \ + if (value) \ + __rte_bit_ ## family ## set ## size(addr, nr); \ + else \ + __rte_bit_ ## family ## clear ## size(addr, nr); \ + } + +#define __RTE_GEN_BIT_FLIP(family, fun, qualifier, size) \ + __rte_experimental \ + static inline void \ + __rte_bit_ ## family ## fun ## size(qualifier uint ## size ## _t *addr, \ + unsigned int nr) \ + { \ + bool value; \ + \ + value = __rte_bit_ ## family ## test ## size(addr, nr); \ + __rte_bit_ ## family ## assign ## size(addr, nr, !value); \ + } + +__RTE_GEN_BIT_TEST(, test,, 32) +__RTE_GEN_BIT_SET(, set,, 32) +__RTE_GEN_BIT_CLEAR(, clear,, 32) +__RTE_GEN_BIT_ASSIGN(, assign,, 32) +__RTE_GEN_BIT_FLIP(, flip,, 32) + +__RTE_GEN_BIT_TEST(, test,, 64) +__RTE_GEN_BIT_SET(, set,, 64) +__RTE_GEN_BIT_CLEAR(, clear,, 64) +__RTE_GEN_BIT_ASSIGN(, assign,, 64) +__RTE_GEN_BIT_FLIP(, flip,, 64) + /*------------------------ 32-bit relaxed operations ------------------------*/ /** @@ -787,6 +978,68 @@ rte_log2_u64(uint64_t v) #ifdef __cplusplus } + +/* + * Since C++ doesn't support generic selection (i.e., _Generic), + * function overloading is used instead. Such functions must be + * defined outside 'extern "C"' to be accepted by the compiler. + */ + +#undef rte_bit_test +#undef rte_bit_set +#undef rte_bit_clear +#undef rte_bit_assign +#undef rte_bit_flip + +#define __RTE_BIT_OVERLOAD_SZ_2(fun, qualifier, size, arg1_type, arg1_name) \ + static inline void \ + rte_bit_ ## fun(qualifier uint ## size ## _t *addr, \ + arg1_type arg1_name) \ + { \ + __rte_bit_ ## fun ## size(addr, arg1_name); \ + } + +#define __RTE_BIT_OVERLOAD_2(fun, qualifier, arg1_type, arg1_name) \ + __RTE_BIT_OVERLOAD_SZ_2(fun, qualifier, 32, arg1_type, arg1_name) \ + __RTE_BIT_OVERLOAD_SZ_2(fun, qualifier, 64, arg1_type, arg1_name) + +#define __RTE_BIT_OVERLOAD_SZ_2R(fun, qualifier, size, ret_type, arg1_type, \ + arg1_name) \ + static inline ret_type \ + rte_bit_ ## fun(qualifier uint ## size ## _t *addr, \ + arg1_type arg1_name) \ + { \ + return __rte_bit_ ## fun ## size(addr, arg1_name); \ + } + +#define __RTE_BIT_OVERLOAD_2R(fun, qualifier, ret_type, arg1_type, arg1_name) \ + __RTE_BIT_OVERLOAD_SZ_2R(fun, qualifier, 32, ret_type, arg1_type, \ + arg1_name) \ + __RTE_BIT_OVERLOAD_SZ_2R(fun, qualifier, 64, ret_type, arg1_type, \ + arg1_name) + +#define __RTE_BIT_OVERLOAD_SZ_3(fun, qualifier, size, arg1_type, arg1_name, \ + arg2_type, arg2_name) \ + static inline void \ + rte_bit_ ## fun(uint ## size ## _t *addr, arg1_type arg1_name, \ + arg2_type arg2_name) \ + { \ + __rte_bit_ ## fun ## size(addr, arg1_name, arg2_name); \ + } + +#define __RTE_BIT_OVERLOAD_3(fun, qualifier, arg1_type, arg1_name, arg2_type, \ + arg2_name) \ + __RTE_BIT_OVERLOAD_SZ_3(fun, qualifier, 32, arg1_type, arg1_name, \ + arg2_type, arg2_name) \ + __RTE_BIT_OVERLOAD_SZ_3(fun, qualifier, 64, arg1_type, arg1_name, \ + arg2_type, arg2_name) + +__RTE_BIT_OVERLOAD_2R(test, const, bool, unsigned int, nr) +__RTE_BIT_OVERLOAD_2(set,, unsigned int, nr) +__RTE_BIT_OVERLOAD_2(clear,, unsigned int, nr) +__RTE_BIT_OVERLOAD_3(assign,, unsigned int, nr, bool, value) +__RTE_BIT_OVERLOAD_2(flip,, unsigned int, nr) + #endif #endif /* _RTE_BITOPS_H_ */ -- 2.34.1