From nobody Fri Feb 27 02:29:28 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 4fMXMs3wRlz6T7hj for ; Fri, 27 Feb 2026 02:29:29 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fMXMs0Kscz40ty for ; Fri, 27 Feb 2026 02:29:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772159369; 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=krzFWxKFJreDAwQziefca1tQp+ygJTkL6yY24y8YgwY=; b=HAqQ6T/j5b3smTJXwrZuUpy0OfsixaE1L08C1iGyknIbi54PDFECfuuZv1AQnmyinZxgDh IRmWGoUFhtOiW5jgJoQDJ2SrfaiItunXiKwLDCa21bg0m9VMYgBw+bZGuftdlHS6uHS5fw EAJ3Z/0FNLEJGo4bAA890NThaW4ZzRfNjFso8gULmYZKFVMLwT/T29GtgM+h9TIOBz9kZK 0WUHYw1D5DXfUv2OJgrnDOqxAcrU8LCGzqBSCVocTv5dE/wOY1qybpgEmu3yKUHXWnM2Ku N/KepLEhC+NEYe8zZdprQtdankGKxb1JdFP3N7DB9ukpvKN9OYZYmjliXJnPkg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772159369; a=rsa-sha256; cv=none; b=hM9uGaZOL6haaOFlfrTUbJSYRH1tz+OJZqkybZ4vssmVue3vU70Kd7QI+icDfCnlUyskAQ q255mXwlVx7e1Xm286OdEUkdra5o9dIEYD2hz0uOUYS7dE6mMfVVtKhZ97ukOr6+wq/72H j0Oyc5r/y8UjKNb9fBs1z6kxvdZCT0K4x7venavjYXtkNK29Ax6+RNF+bgiER0vDOVRzDI s1DAjRKSE9ntk8SxMFsmJmMGaORXa+VGlXTHnN9jdk3mqgRwJwkHQ5OBMa4gVq6jkNYBXy 0OX+nUckzsjiDR+6j0esq/iKyuQu+PaXsY1YPreQ5CSUh0kOH0n1l5QYxlyUaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772159369; 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=krzFWxKFJreDAwQziefca1tQp+ygJTkL6yY24y8YgwY=; b=uqWOh5mTLQPcT+4h7AjMnk+hGrOePPoUf7aDb/g9PVC6e6OCaL3i0ztTupgB++OnYrdkV/ w7u5wmq1ZhvWfQ7bcgGxp31tcTN8axggWsiLpUC74LMb6TilJ5PF+EVP3qCNLQUltTOfeX A34R89XC/t9ze5Gl6DeE9eac8BCwDfOJlJmvptVuCG99AQq20kL7znfDnSQqxNn8pQAPtZ 99yb6Y+T/N5p4H2gU/T68Pg3Fo4yPbwJW5TRN1Hum7mKiPgc0NKQaDCaKZ3McxR8Ym+4Qu c7GDojzDWPfLCaE9r8QnsBIlx/gXWqUshipbnUUicF/fU9W9zPOZz4IWQBTJGA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fMXMr6Z2vzyZS for ; Fri, 27 Feb 2026 02:29:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 21a1b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 27 Feb 2026 02:29:28 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 5585c7c36518 - stable/15 - 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/stable/15 X-Git-Reftype: branch X-Git-Commit: 5585c7c365180aecb9ffd82723604ee4cde6ffc9 Auto-Submitted: auto-generated Date: Fri, 27 Feb 2026 02:29:28 +0000 Message-Id: <69a10188.21a1b.22132e06@gitrepo.freebsd.org> The branch stable/15 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=5585c7c365180aecb9ffd82723604ee4cde6ffc9 commit 5585c7c365180aecb9ffd82723604ee4cde6ffc9 Author: Bjoern A. Zeeb AuthorDate: 2026-01-20 22:41:12 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-02-26 22:59:59 +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 Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54806 (cherry picked from commit 7e4a2b381dcb5b2bcaf528e010096fd2d14868b1) --- 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 8fac80820f30..e34ba391421a 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) {