From patchwork Mon Feb 26 17:38:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksii Kurochko X-Patchwork-Id: 13572643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A2AFC48BF6 for ; Mon, 26 Feb 2024 17:39:31 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.685697.1066880 (Exim 4.92) (envelope-from ) id 1reewl-0001HB-Md; Mon, 26 Feb 2024 17:39:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 685697.1066880; Mon, 26 Feb 2024 17:39:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1reewl-0001Gn-Ie; Mon, 26 Feb 2024 17:39:23 +0000 Received: by outflank-mailman (input) for mailman id 685697; Mon, 26 Feb 2024 17:39:21 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1reewj-0007o5-I7 for xen-devel@lists.xenproject.org; Mon, 26 Feb 2024 17:39:21 +0000 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [2a00:1450:4864:20::22c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f89e9859-d4cd-11ee-98f5-efadbce2ee36; Mon, 26 Feb 2024 18:39:20 +0100 (CET) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2d28464c554so23731621fa.3 for ; Mon, 26 Feb 2024 09:39:19 -0800 (PST) Received: from fedora.. ([94.75.70.14]) by smtp.gmail.com with ESMTPSA id z8-20020a2e8e88000000b002d0ae22ff6fsm920883ljk.60.2024.02.26.09.39.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 09:39:18 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f89e9859-d4cd-11ee-98f5-efadbce2ee36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708969159; x=1709573959; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xlE/LVl89DqUSGdn7SyMPtS4yZCQebNAKpxbRc6e8bw=; b=MpHP7mRNqs6C2VufmAb9Js1Sangzi9czoJPmP3L7wgYCx8W+3tg63hzBc5b0NTe/if nob8Eidhp+OVOXkFaiKzhDtF2OBs3W2hSZTt6CEmgTPanK2gnF6Hvuthhp6xI3sPJR75 vcmBkm1U+yP9V7L5nqSKrPhjmP00HJPVUTZ5fyH9ZFJPUEzTQDVKl4rzCyZbUUIvSN7j u8wZ6pu5aO7bW0EmDei4ubvHeBuynUDk3U7BWtqXfDcd91O6jLZt9TP+NKSR/OmTCp2/ rZbowiNo8gEFdixa9HCRYN8rlSfMadHNQJAfTZyk3jVWEoWTnGs5eppTbdepFUHMHAM0 nZVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708969159; x=1709573959; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xlE/LVl89DqUSGdn7SyMPtS4yZCQebNAKpxbRc6e8bw=; b=TqP5iI4YqdSau1U8peTcS6yOIxOh59u/N2sDLXvaxG0tqIt3V1agWHeOOV0tiETG+z vlGaIR2dkdBuBMu549CiaFH4QPv6s9+w1hqKg/dS8b/PC8h45LUvu1MvoPTPMOJdZp2j 8Jlg68WQIDl64lyQTquZ8DfepvFd7nJ3lM55WbsDnAKegl3F9+JhanmgIDIIIpmdyQ4d cTkS7UhqN1Y+gdRoeh+IF0oIN+HwymGZMfDxVROKJuVBNWXDzdUxNTrKFOEx6Zt92w6H dQl6ATojB7Byc4GQFlrRt1ZxCB8IgB32nYo6KiZ/LW6DP0uqoNXZBUuYemdqxhM9pWCQ kyOQ== X-Gm-Message-State: AOJu0YxB6KPZ09mngZZcGqcX6JlEr4N5C7M7fqsmq8eTrVMr7OKGYeaO 5gWPHpzeHl2LLSKKMj11I4CuDNUZtaikkImVIK5Q4npv+o326OteRQW8a5pH X-Google-Smtp-Source: AGHT+IEjSQ8o3xX5dVo2wHraeEsZEaWY/KLvFJUb5rGHMzeij7VJlbzkgb8IFvpjotiU9+JEwAdSJw== X-Received: by 2002:a2e:854f:0:b0:2d2:8cf7:ed07 with SMTP id u15-20020a2e854f000000b002d28cf7ed07mr1951027ljj.11.1708969158836; Mon, 26 Feb 2024 09:39:18 -0800 (PST) From: Oleksii Kurochko To: xen-devel@lists.xenproject.org Cc: Oleksii Kurochko , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH v5 07/23] xen/asm-generic: introduce generic hweight64() Date: Mon, 26 Feb 2024 18:38:49 +0100 Message-ID: <15dde1f7c5157321998b5518238b247a27d9fec4.1708962629.git.oleksii.kurochko@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 The generic hweight() function can be useful for architectures that don't have corresponding arch-specific instructions. Signed-off-by: Oleksii Kurochko --- Changes in V5: - new patch --- xen/include/asm-generic/bitops/hweight.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 xen/include/asm-generic/bitops/hweight.h diff --git a/xen/include/asm-generic/bitops/hweight.h b/xen/include/asm-generic/bitops/hweight.h new file mode 100644 index 0000000000..0d7577054e --- /dev/null +++ b/xen/include/asm-generic/bitops/hweight.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_BITOPS_HWEIGHT_H_ +#define _ASM_GENERIC_BITOPS_HWEIGHT_H_ + +/* + * hweightN - returns the hamming weight of a N-bit word + * @x: the word to weigh + * + * The Hamming Weight of a number is the total number of bits set in it. + */ +#define hweight64(x) generic_hweight64(x) + +#endif /* _ASM_GENERIC_BITOPS_HWEIGHT_H_ */