From nobody Sun Jan 25 12:35:54 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dzWNq362Bz6PT5R for ; Sun, 25 Jan 2026 12:35:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dzWNp6Z4Qz3nQk for ; Sun, 25 Jan 2026 12:35:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1769344554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ix4ZknKik7zgISXVWal5mV4mEDoM0gqc4FYvU5W/X8c=; b=R0AH1YJOyM6vbUc6nKc5ECwkO2Pode4FvLcVI0Wf8KcNG/cpNmDg+xcVXmRlTgq2Uuc/Rr luWF7k8aOGJH5g7+xCPP675yZqYlAij5cz7dQ95E1jIr9Xu1Q9O2UfqE64+U3nF9wZVhQR 2JTokEzIiFJXfuuhDAygbwZzb05BrXhA566Ddup9Z57ddlCjD26FlpWzqIQT56EHTC3Ap7 R9N1Xu/X7AfRq9hOI1C/y2NsDL4bc8hwFlowRi+mmnjh+kP5RpxzNkGyaIVcWjTbWcca9S I4DK58K0kQ+8kwLtMCNVQPv7+W8ILYF/Ugg24LVt/IjBis0FlhzD9NYRZkib4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1769344554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ix4ZknKik7zgISXVWal5mV4mEDoM0gqc4FYvU5W/X8c=; b=SuwJjezvT8zAK5vfniyaWmGU2OnP0ohbuiU9ekl/5SCvAKCdLRb9R1Ffv0aRgLSJWHfUyP ZwLdPS6E3P7+6OsrXAkEBn68MjSEL/xxJYZvFYbgIJB26MVCNm23C/D1TRngxXB3aC1qPX iQu1de1EgBO9yq5ZktqMc6nB4nQ/EeVBtefsAseuFdIC8kT8Hx220OhfuG1c84/iY7Mneo +PT1IThI5CL5JghPpLgEnEZ6W+5id5h32+irfeGkAbH5uy2Pua1ZzddyKINznxyxDrhu58 +jDKdRR2cAvwp/4xY3vSv4ehsKRYDTDRLAy47bAZErPgpMUJL99resQH9rLX1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1769344554; a=rsa-sha256; cv=none; b=KkYbW4KAo5QZwUC/EWB8EI31pQLKJ/Ku3kee+Bm7GfR10RC5Ey0yhvpKRUoJfLuI+8I48z HR1LgqnBiUtGTbRKR4HJDqzjsP7Z981RtLVJYpRBr48KK4wHu5S7VVpOJUTBMj8T33RZ31 WQ4JwenKxqzBYmDPlqJeYiUaD+NhRRs4uq2q4ox1PwPC568ZOpAg4kLhyh2MJ/mSR93KMW iMQDFLemPPbgPsuj46jESyOhhQ/CXlu4zfGwyYIKSEoLL0bNtCuy5cqo/7G0cWjdmJxghH w0gdNqDK9gal1OfmXa3GW/ZYm7/m7vA/OaQJ3Aie1UgU28TcUpNBKgCgYmyOSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dzWNp660Lzbhn for ; Sun, 25 Jan 2026 12:35:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4605b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 25 Jan 2026 12:35:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 7e4a2b381dcb - main - LinuxKPI: improve hweight if complie time constant List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7e4a2b381dcb5b2bcaf528e010096fd2d14868b1 Auto-Submitted: auto-generated Date: Sun, 25 Jan 2026 12:35:54 +0000 Message-Id: <69760e2a.4605b.3f960e22@gitrepo.freebsd.org> The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=7e4a2b381dcb5b2bcaf528e010096fd2d14868b1 commit 7e4a2b381dcb5b2bcaf528e010096fd2d14868b1 Author: Bjoern A. Zeeb AuthorDate: 2026-01-20 22:41:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-01-25 12:35:22 +0000 LinuxKPI: improve hweight if complie time constant rtw89(4) uses a static_assert() with hweight calls. In order to avoid compile time errors, deal with the case when the arguments to hweight are complie time constant. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54806 --- sys/compat/linuxkpi/common/include/linux/bitops.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index ebe9aa120094..125081ab5b74 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -51,12 +51,6 @@ #define BITS_PER_TYPE(t) (sizeof(t) * BITS_PER_BYTE) #define BITS_TO_BYTES(n) howmany((n), BITS_PER_BYTE) -#define hweight8(x) bitcount((uint8_t)(x)) -#define hweight16(x) bitcount16(x) -#define hweight32(x) bitcount32(x) -#define hweight64(x) bitcount64(x) -#define hweight_long(x) bitcountl(x) - #if __has_builtin(__builtin_popcountg) #define HWEIGHT8(x) (__builtin_popcountg((uint8_t)(x))) #define HWEIGHT16(x) (__builtin_popcountg((uint16_t)(x))) @@ -70,6 +64,12 @@ #define HWEIGHT64(x) (__const_bitcount64((uint64_t)(x))) #endif +#define hweight8(x) (__builtin_constant_p(x) ? HWEIGHT8(x) : bitcount((uint8_t)(x))) +#define hweight16(x) (__builtin_constant_p(x) ? HWEIGHT16(x) : bitcount16(x)) +#define hweight32(x) (__builtin_constant_p(x) ? HWEIGHT32(x) : bitcount32(x)) +#define hweight64(x) (__builtin_constant_p(x) ? HWEIGHT64(x) : bitcount64(x)) +#define hweight_long(x) bitcountl(x) + static inline int __ffs(int mask) {