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 4E6F843F65; Thu, 2 May 2024 08:07:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 51095402D4; Thu, 2 May 2024 08:07:33 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2068.outbound.protection.outlook.com [40.107.20.68]) by mails.dpdk.org (Postfix) with ESMTP id 462994026F for ; Thu, 2 May 2024 08:07:31 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hkKBbR8X4Oet4ZKs7W+FGC54m4pcHpIHd4IbhFKxz7toR7jqnlzypi97xE/lsrD+z0l35JLhJCaTs+GPyQrmUtJsIqDqb9BG1PxH9ZRBSnz4sh91wlOfkEohJ1gZMQmMmZxJJxag6Tqr6VZGB7MNpWO1glYdaO5revXIzUn45ovXSO+UdN3AWQ9nw+ZwMjQFBdwO66G0hmQZSbgHp/mp97BaXzXZr11fO745p1/wH6XXLaS1seu6aBW7cjXZXbsQkD54u4knwRK18aRepvKc+gdqhLCPHnKqoJZiLv14KPKhukU71Q2GBMptYPPKINMbVH19oNwIPj8yErEWLf+Rqw== 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=uGaYNBWczZiaiy2F567USLR166LHBzCdDI8GvTpYwsg=; b=ePN6cjHDdiiMXKstlrkAwDjaamosm4ZR+IKft67F9Snod0Z7VVH0UemRd7Mq+SC1aJfnXe4+lU7bzVYrkiQoKKtgfnzmiL3p+9ueAed7PPC5Hg4mkkLlVLWfqSiSPjVZGrm/b2jUWe1fuZ+dcxN70GUEFJupbD3Dn23S5mW/IPcShvZ3/ndVb/VzeggXeGIirNnFMw0e/RYEWYOBF6myiT/gMAcqG7Ie0h+ZZEFOA6xSqmB/qIjRw2RnmkJGS2pZ9Dwl2NF7el354iwe61nrczocmRE3YooOX97RoNjULpVmCBRDcszQND//QAG+X1kwXMaYim9loNWO/StuxzuPBw== 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=uGaYNBWczZiaiy2F567USLR166LHBzCdDI8GvTpYwsg=; b=R5dxa1mwFH60c5yccaHqdUBHsfAy45qFbew7gUIoU9KvA374YXvPDXHlHVdCFxf5RAJJQPiw/qAstdB+3ZgvvSlTgGOUY7iopiW1sOsXJGi/PWVZRM/NbTlN6aqSx/l7oJnAgMuy1P0lUQ2+mJmYiBcV6KpyNwvnB2rk1KyaOywOz1Ho7W145RKDKJ8l6QDd0vUXIKpoc1ZsfRMowbGbIvXDu8qBIF5uFHjWPcKhAWROpLZixYyC81e85xSDLGzoQrHMjrv5ViAQZuFHeqgLMGHIX5j18IE5By9zL7oCgrByW/mIOlKPvD5TJeR7FouUr/FtmV41xfgilA658OXbGA== Received: from DUZPR01CA0190.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::8) by GVXPR07MB9751.eurprd07.prod.outlook.com (2603:10a6:150:11c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.29; Thu, 2 May 2024 06:07:29 +0000 Received: from DB1PEPF00039230.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::28) by DUZPR01CA0190.outlook.office365.com (2603:10a6:10:4b6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.29 via Frontend Transport; Thu, 2 May 2024 06:07:29 +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 DB1PEPF00039230.mail.protection.outlook.com (10.167.8.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Thu, 2 May 2024 06:07:29 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.61) with Microsoft SMTP Server id 15.2.1544.9; Thu, 2 May 2024 08:07:28 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id C9C29380061; Thu, 2 May 2024 08:07:28 +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 v6 1/6] eal: extend bit manipulation functionality Date: Thu, 2 May 2024 07:57:01 +0200 Message-ID: <20240502055706.112443-2-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240502055706.112443-1-mattias.ronnblom@ericsson.com> References: <20240430120810.108928-2-mattias.ronnblom@ericsson.com> <20240502055706.112443-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: DB1PEPF00039230:EE_|GVXPR07MB9751:EE_ X-MS-Office365-Filtering-Correlation-Id: 468adaf1-448e-4f5d-1c78-08dc6a6e25ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|36860700004|376005; X-Microsoft-Antispam-Message-Info: =?utf-8?B?UExIMWo3a09KamNJaHZpK1IxV3BhSmY5RzlKQ2tWUTdGSW1KdlRvQW1yZzB6?= =?utf-8?B?RzNxallOaEtqYUVJWGxqVDRIV3h3TnhpN2lJQVVldVFxb0prNEJzNWxUUU9l?= =?utf-8?B?eFFySFpTL1B4aFQ5OERHazB1Z202REk5Ym9LMFo4dGZZbkpOL2JrMDJGL1ZB?= =?utf-8?B?V05YaVIxaWpOdHN3REhzNDZCZDhKK1A2djZGYjU3QlkvK0tFOWs3Vk5pWmFn?= =?utf-8?B?dHRQaXptenhjdmx2VE8wM1BhQnNMbWMzMjY4b2FXWGFEUHhwM3lOTmVOaEhZ?= =?utf-8?B?emdCaUtGL0NTSU1YZ3ZTUEtTSS85QzByWjI1UWVHZlpsekVDQmMycDNXMUJD?= =?utf-8?B?YVVNb3Qwc1NZOXFtRGduMXVra2NTeTd4amZkbnlEaEZjQmV2anhrY0k1dHpw?= =?utf-8?B?bndBT3R6OVd2eEkyYkg1Y1NuWW5CSUdndVlUTFoyT0sxRUFFM3haODZSeWtY?= =?utf-8?B?cTB1cmtCeFh6bWt1Zlh6WjJpL2l6WDdvYnV5WVBqM01CQTlWZFNYTVFwODNN?= =?utf-8?B?S0pJL0lOQU16Nm44aHJ6dm9SaElKTm41ZmhJdkI2T0ZreDdFcEd4cDRiZnE5?= =?utf-8?B?SVdBcVFxV200a0dzWGxCazJIUWRLL3Zad3htcFpleUNQcVFQOWdiUzllTE9s?= =?utf-8?B?OEZVV2lpdEU5NnBuRWtPc3dNVXptVFpIRGFxT0NSWlFOaW5GUEJUMnlBaGox?= =?utf-8?B?Ti9LWU55Zll3TmFCM2tUaVZ6YW4vR1RjMVk0bVNwblRXci9NTEhyN2NLYVg1?= =?utf-8?B?MU1qZGpHV1FmbFo4dmdjVUxWamdzalRNMmV3aHVhUVdCZ1YrZW0xbStaTGdJ?= =?utf-8?B?TXY0MjBzemtNL3NaTUdKdXAxeDcwQlo4ZFBMSG0vMmpEZkRrcG5tSUdLNjdB?= =?utf-8?B?bkhVY2tUc1JSbGF6ancrcy90MktMMURYTkdLR285Ym5DUWNSVWVKL2ZVUndL?= =?utf-8?B?MHR3QWxDN3B0MFdMSEE5WlAvaVFJd213L3I3QW5Pb1VMZ1c2elVudmhnNTZ2?= =?utf-8?B?eXd1bEMwZHNiMG5udzQrWEF5RnBCSWdiZ3lkQUJZZGkxaXROOGtwQlVNeWds?= =?utf-8?B?eEd2Sm5EUGZCZHhORlFTZEhnZVpDNCtEM0dwdk9lUnh0S2kwRXFjUm1sU2VF?= =?utf-8?B?U09CeHJjcjNMZTVobXFIV2RpRmEyQVJPVHRYV1FScGg5Nzljek1vME02Nllp?= =?utf-8?B?TVlmWEdWVnhSM28vSHBJbk1QK0pWZWh2dTVxczVHWldxS2NFblZrMkNuRk81?= =?utf-8?B?R1ljcWZhM2hHbndQWGJLTVdKcytJNDg2aW83Y3N6QjM4RDdOKzRKYmZ6MzVB?= =?utf-8?B?Y21jK2R3TFBTU2tMK1Vvd1BqWjdlSmVlTmhtbUFacjIyUWZERzFpeXhQemxz?= =?utf-8?B?aXVqb0FaNkVDUHRnVmNkeWovZHJOSlhQK1cxRXBwMDZRaGI1dVY3T01GTm1y?= =?utf-8?B?bEJtdnNLdk1XclJUUU1XZDJsOC9USHRFd0tqWjVEMElJS2NUbkxsZmV3S09y?= =?utf-8?B?d3pBRElCSm4rcURITUIrNmwyRUlPWURRNGxVUkpxYUhEV0tDdDF2TXBPd2ls?= =?utf-8?B?MlQxQTAzNG55TEFGRFVxejJ5UTBJc2wzcTFFN2NRbDRaeE56cGs5ZHVQR1Fs?= =?utf-8?B?aktyN0VpL1owREF2OHFyUHpBMk80Y0dBV2hJS0o3bVFtT2w1cEdVcjFRQ3NV?= =?utf-8?B?Mi8vZ1RDV0xBVXZnanIxWUhtaEt6R3I1R2lBU0h0QWtYK2l6akt3OTl4TXFi?= =?utf-8?B?WEpwWG9BcExEUVNwcnhKdkdDM29GUzZ4am95SFliSFhLSlFUdEFianFZcDNt?= =?utf-8?B?RkhESnN1V0xaTEFyVUJtelBxWGRPblAzcnlVYThvMytsWUIybnE1aldHZjdq?= =?utf-8?Q?HFSRde1+eq6go?= 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)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2024 06:07:29.4033 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 468adaf1-448e-4f5d-1c78-08dc6a6e25ea 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: DB1PEPF00039230.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR07MB9751 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. 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. Signed-off-by: Mattias Rönnblom Acked-by: Morten Brørup Acked-by: Tyler Retzlaff --- lib/eal/include/rte_bitops.h | 259 ++++++++++++++++++++++++++++++++++- 1 file changed, 257 insertions(+), 2 deletions(-) diff --git a/lib/eal/include/rte_bitops.h b/lib/eal/include/rte_bitops.h index 449565eeae..3297133e22 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,196 @@ 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(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 +980,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