From nobody Sun Jan 25 12:35:54 2026 X-Original-To: dev-commits-src-all@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 4dzWNq35F3z6PT1M 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 4dzWNp6rKKz3n64 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=1769344555; 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=pwgW3sRTpXDAbUYA4kP8JnlqZQ2QeNjrKhhKgxPDvbLFJEXJHwbhT7fMJWKhcjOeMOvhko w90zCkE3mBwXNNDhO7/OpE395S1A/PrBzxX1nvZN9DfBeqz9TuOWvPSmAH4uDTH3RBwuLK DRq4WpWB72Kk2ObScmWDw/SAOTwmeChUtrBbQtO5DDhZAk/1W2vkRrdhjmlmGKvDAvU5Zz MLUuGSR0nE1RBzDdX3aamm++jeyEN3Os2DEihHtGmXLU/nsWkuk9bqNHjd5jj1L+eUxoQi 4FFCXW5C9q7OyKaEd3Xrv3DwNmA4+sOJVb5QRMsdJHxpmw8to0UlLO+Ax8X1UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1769344555; 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=nEt8pWVojkUgaOxOXWifoSsmJ1Yh7yvxC8PkFp+yDutX1nBllpG40n0EOg2ULx852qYDs3 v5Chrh4MmwS7fajqB0NATRscNx5RkGEChBzug3Z1uhYcbHDTn/iqgHOrUh/0ShAiPCf6GB YlynWfGjgRy8Z0uBSf5pjVDKqV9sioT10Y+FJLYxHxKSOISnhQ1Eg95Kldlxnk4EEDPmME Df4O6hVFUiO8EXjGgNqIAJXEsOX5rAAj8sz/fgG+9AqPQd4AqcotAplqti7qwIYh0ofz+Y XPtFaBqoZp+dKAFw163ZY3pAglPKEJhlod2O16yThiyafsu2ZW6xWjSqZsAPCA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1769344555; a=rsa-sha256; cv=none; b=M8T1K3wvI1fdsaKG92ux/r8DhzJ2Wo/4ddMbBWdecXmGbz7PPpDtpCl7SKAqJe6xn3ZzTS v3N14sncHOsqRd4Brd7bpRODyKhpmqTpl4Km8/1Connwn2TWBD8ccKXyRDPoWw+RjrgdXi 1W997pSk6TMfxf0iFNTc3tLrZ2L+iXX0Nxg/IBx9tHKX9wLWAx9zOeFtDzM2aRbaTkYV6P UXhTzeAMVD9A3yhfTUnJlLZtk8l8KU6sfIpjz7amO4wSXjrLtt1kD6eAjhDMSdjPm3vFEG tgycK8VQDahVdYJhI9/es/LOG8ac6kyijIiqQqf8ZShAoPBSuZ2iUsM9hCWT1A== 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 4dzWNp661yzc0B 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 all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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) {