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 1740E43FAE; Sun, 5 May 2024 10:48:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 17A4D402E2; Sun, 5 May 2024 10:48:01 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2087.outbound.protection.outlook.com [40.107.7.87]) by mails.dpdk.org (Postfix) with ESMTP id 79FA84028C for ; Sun, 5 May 2024 10:47:58 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JsKy/4ezw3mY+ntUoup1KAVkwUuOh/shFszaLuOUA+M04LCkNqh6DdcshoIh/c7/h/niL30W9SVO7kGf2wQNYS40fzf35SeQz7tq1SBo+A9MIxyKjtai2Cq7scEUkGqVHp/Em4KaF7EeOtAB7dAsYKjg7kIrUN1jrZQ6pW0JLrrF7QimNXQcW/Bfo3EOodpr3sdcVoTpU4CoK197O8FtM/DGdnUngU0taFzJqhrYpWEGnrUzglriEjjZh1QxZZdp1TCI78+7Dt1KICrQXlF6mt7Rf+kNoN8GhwtJAobzwOI9X4ZizkEolNcWN2r7EoZ0YznUT3kd2Q3HsUwqq0cxhA== 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=CJT2wPJ4jEV+NdBXY3YN80/WG7TiPNnUKtiGrX0K+GPWhmrvHZNMLtAHD62oCNQUSdYjS/s5Q70+iIyxqt2KzB7FGMoVDeCCaV9OFL9PRGZBee8imiM1wBL/St+/OJvd/eULLDO2/dJEgGfXXo2ggevInnp1KAlnD3t7mobipPesMbv4Ylp0wIGeVv2NX6Qxp6QGFUugAZsjsEyXcD0hfqN4nlXl8Lzx5nCP6TQjSIcVHrPvPB8oThDwAfhUIJHzaTVvsgliyBt7zlvtAKoac7pDqvi4LgkyQcXSxqwBaZ/RpeQ/6hcEUl1aU+50tVhw9i/Dq0t17TDdDPqKQjmNhQ== 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=gYLBbLwIln9MlnMGoXwMzN+9H53zU8pfmsp7YMf5IHTDvhWpKINROxiHkwF46IzUShl1suzQ1i64qhXv7DwoA818x6Dedcuy4HKYWd0lg8fpfM19tXvRL7XvIElOEZ+9fsKY3G9i4rrdV+j/b/6y1zLd2I4J3LPKptg2+c/fnhKIwhFMDYQVjFydhGG3EDrdKafxO7I6oSqqAH+sz+bxN9P0uiVWJUn3L5o1IL0T+YmrS6mlY6DqZ3R0pHRBrwWLQxyMQv7C1NgHYB74KE7M0MPcgX2BzSHmIca7lwgwcj3eJ0NBeJaLc+0yOkHU8EMNUKviwU/ND+BpZEuOwuDUlg== Received: from AM0PR02CA0034.eurprd02.prod.outlook.com (2603:10a6:208:3e::47) by DBAPR07MB6567.eurprd07.prod.outlook.com (2603:10a6:10:188::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.39; Sun, 5 May 2024 08:47:56 +0000 Received: from AM3PEPF00009BA0.eurprd04.prod.outlook.com (2603:10a6:208:3e:cafe::b2) by AM0PR02CA0034.outlook.office365.com (2603:10a6:208:3e::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.40 via Frontend Transport; Sun, 5 May 2024 08:47:56 +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 AM3PEPF00009BA0.mail.protection.outlook.com (10.167.16.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Sun, 5 May 2024 08:47:56 +0000 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.142.248) by smtp-central.internal.ericsson.com (100.87.178.68) with Microsoft SMTP Server id 15.2.1544.9; Sun, 5 May 2024 10:47:56 +0200 Received: from breslau.. (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id 5D89038007A; Sun, 5 May 2024 10:47:56 +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 v7 1/6] eal: extend bit manipulation functionality Date: Sun, 5 May 2024 10:37:32 +0200 Message-ID: <20240505083737.118649-2-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240505083737.118649-1-mattias.ronnblom@ericsson.com> References: <20240502055706.112443-2-mattias.ronnblom@ericsson.com> <20240505083737.118649-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: AM3PEPF00009BA0:EE_|DBAPR07MB6567:EE_ X-MS-Office365-Filtering-Correlation-Id: 07cde067-3f1a-4643-ab32-08dc6ce00f81 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|36860700004|82310400017|1800799015; X-Microsoft-Antispam-Message-Info: =?utf-8?B?anhYbHR1S1IxZmdEK3VvQkpaSGlkM0Jld2VTSmdQVnEyeHJ2OHFiTUlCQXdV?= =?utf-8?B?OHNod0thQ2VFNEpMUEZzR3ZUcE0yY0ZZQTV1eFA2ejFZUm51UVBIOUlaNE1B?= =?utf-8?B?bmdkNkpKSGFRQ0lteG5hMERsRlk4VTFMak9iSFVJbG9NOUhVUHJ4MHpTdktT?= =?utf-8?B?dXg0NmF0bWc4VFkwdWZsV1VzQnRDRUZkWS9nV0lmUTUyckt1RnFRMjA1QnpN?= =?utf-8?B?dmlxNUZqQ0VTT21sZTNvSlliSytOS2FIVXA3ZkIyckhSbGc1NGQzOHpkME9W?= =?utf-8?B?bER0WldwVkpqNzlZdW1vS2p5Y0ZiMVJobTQ2TDEyajVBODVaM3I2OEplb2Ev?= =?utf-8?B?RmJ0MkU5clFnc2o5YWlVajhPcnduMFVKL3ZCc05jbEZYanNQN2RPVUxtd1ZF?= =?utf-8?B?bzBmR1dRZVVEbGdPcE0wTUNJMXlJUkM3TmIxNlVsbXdCcWxHNWU5Ym9pTEhr?= =?utf-8?B?eUlwYlZoQTVsemJRVnU5eVhrTEZ2ejFOajl6RHJ6R09XekVReEt1TGF4M284?= =?utf-8?B?bVJZREVaRk1idkVuYVZEcUZDSmowaFlkV0F1Z1BTOU5SUTJCVElUMHkvTU9M?= =?utf-8?B?SGQvcHhQVlBCa3ZDVzRQUUNVRi8zekZnWTRtVGdQT1J3am9aT3ZaMlRucmdG?= =?utf-8?B?QkdVb0VFV1JaSnY4ZXRMb21PVFFSR29BT2RnYk1IZURTbUF2dTRJTlZra2tq?= =?utf-8?B?RjVyYmZrM0NadVV6OE56aFp6d3FQQk9hTHduVmY1dlFTUEhpQVNGMXVCUm94?= =?utf-8?B?MnhmZzR1U01tcnlGbHIxMUozcUMrNCttajB1bUE1K2tTcGM2K2NiZ2Fjd2l2?= =?utf-8?B?V1F1S0d1c01tM1RRM2VDbkNDQ0UrVzdzekg5L2kzdmg4UWNTRUR6NWFURm5s?= =?utf-8?B?ajQvUWFuYkdMcTdpbG0rdldKK2NhV3ZXMEJoL1Vsa09Sak51M1Brd0NKbnlD?= =?utf-8?B?c0JNN3F0OTZvWmJYWUhTbkdyWTNBYjVESDdLYjNsam5oSjcxenh5QWpOTmxX?= =?utf-8?B?NXpWbEQwTmJ5VlAvcUdwR2pDQlYwYWJMNWRDVE85cGJScFNTK0o2VkloOFAr?= =?utf-8?B?aWUvbU0rbUM3SVY3VUVRa0JFU3RDdk14U1lJeEdQaFlTUjN6UDRYYmtuZVNE?= =?utf-8?B?TmFpWmU2UEZ4b0RWbDIveENSdklaOXhFTUFhUUtHbVYwdXhMOEVOVHJqV1pP?= =?utf-8?B?SnJYSTlWUTJHTTJFMTBRNE9KcDUweXh1SGdvMVdMT0hnUTIvOXNvaHhzbCtB?= =?utf-8?B?SWMxdkcrU1Uzb0Y4YVljb3h4c1k2Tm5LSXNPVk5xeGdlRXZtSXVFeHRqdUt3?= =?utf-8?B?UVBDaERiajZWd1RmZmw3azRWbytUTW5uQ21UWlEzeEhBUFZJbkU3M254ZmRn?= =?utf-8?B?VytjTmlNeDE0UXB6aitCVGZuVXZNWVNVSHdkcHhNaXp0emloZ0tUN0hnODRI?= =?utf-8?B?M3B6TWZ1TTByNXZ1MG5ZV0xhSVZjQ2tsM0djOUQ2RHdhWW5oeUc1YkdUdjEr?= =?utf-8?B?a0lQNnZNaVh5QWxPazc1amZWb05UUHhKY2lRSFgxZHFRNDc3anhxVkU4V1F4?= =?utf-8?B?V1pXY3orcXdVWUpaM08yTVh2S3kvYzhpM1hqTFh5cktWRHRBYkpFLzdiSFZS?= =?utf-8?B?NTZxckM4NC9Rbm1YWGtSR1NXVm5jcjk5d01VNnp5Qlg5aXhLdlZNWkl1M2Y2?= =?utf-8?B?bExPb2Z6aGtjZGgya3l6U3dBc01FMGFBVjkvdkh0SWVEOXY4T25wV0VxS1dE?= =?utf-8?B?bGRxS3gyTUZURWs3SERWemNtRXA5MUkxcDcxc2kxTEVJeUI4czVmTUloVEFw?= =?utf-8?B?UkJTZWVta3RHdlhydXFLcEhaZ2dwdnYyeHk3ZFY4V1BVL1A2bFl5Q1phZGNa?= =?utf-8?Q?tnQALLM76OFk0?= 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)(376005)(36860700004)(82310400017)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2024 08:47:56.7773 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 07cde067-3f1a-4643-ab32-08dc6ce00f81 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: AM3PEPF00009BA0.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR07MB6567 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