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 34C0B45952; Tue, 10 Sep 2024 08:30:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2796E42791; Tue, 10 Sep 2024 08:30:25 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2051.outbound.protection.outlook.com [40.107.241.51]) by mails.dpdk.org (Postfix) with ESMTP id 9F5D042759 for ; Tue, 10 Sep 2024 08:30:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=N8vRZvQM592f6QRJT7lYeu75wNyiXKjUHJpM0IPomt55F6H6jzDhFIWoGbskMJpdHcM5Tn0cTjuf6TtQm9pqTwJWEznQVZ1UP/hxy+j+frvVhRiHv7ZaAtoYHVeSVm8YjqXNe1cqX2eWDDlN1vJJ2dSXt8w5BQxLdV7XrQX/FrdO2U1ocN3+wdV1jxVLSFDrNkKKG/BkWer0z6DKkF+5Aegi80laLG3iBSwyLw/KOZaeWhU8EpVq/BLc/QGNo4W7V5dWn0eAOqoCErlgJO51nJdl+KobYCB5LGhVhc+g6Wafz5vBjbTuBTgBmFccHewatL+xoi2PhpqWpAupbLYkgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=5UKgQdVaciDeShGgGbM6oo5b5b9ozFm128R5ONKGWa0=; b=Ra3pbQv9m1eDwoNReOF5l8MtJm55DD+bqjSfJTrFlPi7Q0mPM5ubRqPBAq1RIoAK0itNg36B8u7ULqg2ei7ii7DgBYcfWrL7McSMKemdi9MXY7XeqeeATH4XlLr4HSRTXShZ3ahyxAQ0GZcPFfbhyX/NofA1sjsdZwqTvwS5yjqhnGsuX80rf6q/7unNEzN/FMymzvJaGw0/vWdCuSp/EPfITA9/n5GKOcvrWJdp5UGKeA1V4E7YV9RDAeliEyZE4n4jcSaZWKhmdJy8BQyNRLmfCa/lA8jIXT71yyvrK+PnF/cr5OiwxkaSkISHXMMqf8VCnn0GoKDU/6NZByoOgw== 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=5UKgQdVaciDeShGgGbM6oo5b5b9ozFm128R5ONKGWa0=; b=WRc78rYrHf8oS02biw+ldeYAUX0bh1D0TeY/ccuT6AKjcnoKm55EGFlIp0wJH9MMC8QOMZljNPQw5sG1e9k224IRpfnwQS9k5yLwJOKkAlb7YT6NfpDl9i5nLrb9zsFmY10jM+FmU5NiWddjl6FjYyq5B33jPX+CFGwpb4rqsvLxRGnjByKBh6Pg2dxYcLs+Z0e6laITcItB60ZOWtOfNBdKP+Bm+zc4I/X7sScNsLZ2WEdCDkYssCXYpu1rQ18q17rqlmZXQ19ss62PCv5JduoqYqj9qRJsHnEyJ/1DvR7ByeWzuFUpKLWdGDI+NahcCZJ4Thxu+hW9lLvq+qLvkA== Received: from DU2PR04CA0074.eurprd04.prod.outlook.com (2603:10a6:10:232::19) by PA4PR07MB7277.eurprd07.prod.outlook.com (2603:10a6:102:fa::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Tue, 10 Sep 2024 06:30:14 +0000 Received: from DU2PEPF00028D05.eurprd03.prod.outlook.com (2603:10a6:10:232:cafe::9e) by DU2PR04CA0074.outlook.office365.com (2603:10a6:10:232::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24 via Frontend Transport; Tue, 10 Sep 2024 06:30:14 +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 DU2PEPF00028D05.mail.protection.outlook.com (10.167.242.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Tue, 10 Sep 2024 06:30:13 +0000 Received: from seliicinfr00050.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.60) with Microsoft SMTP Server id 15.2.1544.11; Tue, 10 Sep 2024 08:30:12 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00050.seli.gic.ericsson.se (Postfix) with ESMTP id A583D1C006A; Tue, 10 Sep 2024 08:30:12 +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?= , Jack Bond-Preston , David Marchand , Chengwen Feng , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Subject: [PATCH v5 2/6] eal: extend bit manipulation functionality Date: Tue, 10 Sep 2024 08:20:47 +0200 Message-ID: <20240910062051.699096-3-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240910062051.699096-1-mattias.ronnblom@ericsson.com> References: <20240909145743.697342-2-mattias.ronnblom@ericsson.com> <20240910062051.699096-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: DU2PEPF00028D05:EE_|PA4PR07MB7277:EE_ X-MS-Office365-Filtering-Correlation-Id: e66e3a45-eab8-466e-1728-08dcd16206ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?aTR3R0t2azJLckNwYUFmdWkvSU5Ua0N6blBYOG1ZL3VQaFoxRGI4YzZkTW9N?= =?utf-8?B?YXZ5bTBwVElPWkVDOEhxVlQyaFAyWEJHd1lRVmliamEyZC9qSUxYdlB3MFc2?= =?utf-8?B?L3pTSlJQZUFrdko4SGFIL1hIT2xYT2gwK05VUUc0ZitlU0o4eWVGSVIxSDYz?= =?utf-8?B?aTlmMHplNHowSTVBZmZGdlZNVTlvazRYc012OVc3K3Zic2VaTzh5S2RTYWp5?= =?utf-8?B?YlZJM0N6Nk15eElveUZpZUJTL1RuMkh1TVhmeTdQNDBPS1o1V1h0V09tYUU1?= =?utf-8?B?cUdjTFpjVlM4UzFRc2dZaVdJSDhpRzlDUTRnbDVoanpYR3dlMlZmekRza0NW?= =?utf-8?B?UTZkZE11ejB1a2ttaEJFZFdRZXd2Z1lEaGlRVmFjRTVQYWRwNytpVHZQaU9K?= =?utf-8?B?Uk1PVVVvQS9PTGlYU2swbWwzZHVwSTl6TUd2bEhkbk15WUVDbjZodE9FRTBU?= =?utf-8?B?MGpSZGlCOG8vRU9mMUtQVFJFZW5SNENVM2Rtckt2Qjl2NkdPbWFzNk1QVzhl?= =?utf-8?B?RFdubklGeDJ3QTR0N1pObktUVmZpdG9HZm95YjhYM1JNUTNjMHhCT0FuMnA5?= =?utf-8?B?cFh5YThIaTVEb0lKVnFVU1VMQkMzVHZqYmg0d3cvbThXa1A3aXRHNnVzQWVF?= =?utf-8?B?RnpsK3Fpb2hVZGVBL1R2WjVVUzI5OHZ5WGl5eWJoMHR4alkvYjJYOFZWUFE3?= =?utf-8?B?bE1SVUFaeGVjSyt3ekZaOG5ZaEpma3dDZWFsUG05ZFNMLzZFSEZ2aFd5WC9Y?= =?utf-8?B?MkxBUEhLd0JZMk1qbGRjamdzYjNjV2M1VW1HUjRVRnBOZEhldUNxV2FRWXl5?= =?utf-8?B?TEhLeFo3NGRQaERnaHRNRlpmSmtRWXRvMTRhaEVHV3QzSkNzNnF3ZWROV2Vm?= =?utf-8?B?OUQvVGRqMmhyc2ZydEhEQjlDZGlxcEdlbGQxeVFFU2NoVXZjY2c1NlpyTEY1?= =?utf-8?B?d1FOZFcwc0VpcC9JNHQ3M1dmUjFaWmlGeVNMaVU1YUsrV0I5SVJycGh5YUtr?= =?utf-8?B?YlZzQnJkbXZkbUEwaEVwL3dPY01MdkVGSFhDbnhKYWlzR2wzOXUzQUpKNnhy?= =?utf-8?B?aHpWb1I5ZCtxalRwYU5sN0Y0ZXFLVFdjcCsreWRFQWFTMDh1bkVKWDQxRkgv?= =?utf-8?B?MFMxbWhTZFppb1d3TExRKzd0cFV1dkdxdSswcXFFMnY2K2dsMG0wcGcrQjFC?= =?utf-8?B?dUFyUHhaQWxEdVk5ajhqa2ROZWw4ZHU2QXFKQTRRVVFBblhJOFZkMzd4ZFUz?= =?utf-8?B?Ulo0TEZldnloWWJHOWhuaG8yS2hpS0QwL0xhaGlXTkc3RGZxcFVrYXllekQ4?= =?utf-8?B?TG1DV3RNYjllbmdTelFMVDdHZVFGSndvUWxJSkR5LzY2S1EzSVBMZjZ0blNk?= =?utf-8?B?TWhNMGk5MmlYaWtjQS9HRVkxTUZuWE1jSmhFRlV4bVBha0VxdDFRTnZDN0NZ?= =?utf-8?B?c1ErSFNENlBCdnpvRTdzY2NET3ozZ3p6L3UwSGp0amkrRmhRcC9ubjJVRFc2?= =?utf-8?B?STQ5eDlSTWU2K1NSemc0WGE0Tjc4KytUN3hDR3BTUUJaMy8rblY5V0YrcWpw?= =?utf-8?B?ME5KdjJBN0RhNTFYaWtpVFFzOXFzcDFXKzZXdlJueTdyWUdvaXdDbG4zTlI2?= =?utf-8?B?Q3FHVy9NZS9HbExEeHpKR0FjeVA4OWxGYlIzUmhxQkJ2Q2JORG1IK1BuUjh2?= =?utf-8?B?RW9yenpJUFdFOVFhdmJGOStkQURqKzRHUkZOeXg0M3F1cTBOY1pJcUtnWnlK?= =?utf-8?B?VmQ2N1VkNDBFLzFvalJPamFLNFo2cG1SdjBvcjN5a0lkV0M0UitFZU12SFM4?= =?utf-8?B?UkNqb3E1ckxQc24xL0xXSFJoYmJMck13KzFOWWdLeHd3UHFqWmgwd2Qrd1dy?= =?utf-8?B?bEM1aGZFODhVVjFMVTNnUmRJamhieTNITWs1dzE3SEsvV21wYS9TYnBmTHVC?= =?utf-8?Q?GIbhvbb3n5GHxGwXuiDtsX2Zcuhik9y2?= 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:(13230040)(1800799024)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Sep 2024 06:30:13.2188 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e66e3a45-eab8-466e-1728-08dcd16206ed 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: DU2PEPF00028D05.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR07MB7277 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 and modify the value of 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. Signed-off-by: Mattias Rönnblom Acked-by: Morten Brørup Acked-by: Tyler Retzlaff Acked-by: Jack Bond-Preston -- PATCH v3: * Remove unnecessary include. * Remove redundant 'fun' parameter from the __RTE_GEN_BIT_*() macros (Jack Bond-Preston). * Introduce __RTE_BIT_BIT_OPS() macro, consistent with how things are done when generating the atomic bit operations. * Refer to volatile bit op functions as variants instead of families (macro parameter naming). RFC v6: * Have rte_bit_test() accept const-marked bitsets. 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. --- lib/eal/include/rte_bitops.h | 260 ++++++++++++++++++++++++++++++++++- 1 file changed, 258 insertions(+), 2 deletions(-) diff --git a/lib/eal/include/rte_bitops.h b/lib/eal/include/rte_bitops.h index 449565eeae..6915b945ba 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,197 @@ 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, \ + const uint32_t *: __rte_bit_test32, \ + uint64_t *: __rte_bit_test64, \ + const 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(variant, qualifier, size) \ + __rte_experimental \ + static inline bool \ + __rte_bit_ ## variant ## test ## 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(variant, qualifier, size) \ + __rte_experimental \ + static inline void \ + __rte_bit_ ## variant ## set ## 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(variant, qualifier, size) \ + __rte_experimental \ + static inline void \ + __rte_bit_ ## variant ## clear ## 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(variant, qualifier, size) \ + __rte_experimental \ + static inline void \ + __rte_bit_ ## variant ## assign ## size(qualifier uint ## size ## _t *addr, \ + unsigned int nr, bool value) \ + { \ + if (value) \ + __rte_bit_ ## variant ## set ## size(addr, nr); \ + else \ + __rte_bit_ ## variant ## clear ## size(addr, nr); \ + } + +#define __RTE_GEN_BIT_FLIP(variant, qualifier, size) \ + __rte_experimental \ + static inline void \ + __rte_bit_ ## variant ## flip ## size(qualifier uint ## size ## _t *addr, \ + unsigned int nr) \ + { \ + bool value; \ + \ + value = __rte_bit_ ## variant ## test ## size(addr, nr); \ + __rte_bit_ ## variant ## assign ## size(addr, nr, !value); \ + } + +#define __RTE_GEN_BIT_OPS(v, qualifier, size) \ + __RTE_GEN_BIT_TEST(v, qualifier, size) \ + __RTE_GEN_BIT_SET(v, qualifier, size) \ + __RTE_GEN_BIT_CLEAR(v, qualifier, size) \ + __RTE_GEN_BIT_ASSIGN(v, qualifier, size) \ + __RTE_GEN_BIT_FLIP(v, qualifier, size) + +#define __RTE_GEN_BIT_OPS_SIZE(size) \ + __RTE_GEN_BIT_OPS(,, size) + +__RTE_GEN_BIT_OPS_SIZE(32) +__RTE_GEN_BIT_OPS_SIZE(64) + /*------------------------ 32-bit relaxed operations ------------------------*/ /** @@ -787,6 +981,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