From nobody Fri Jan 16 19:41:31 2026 X-Original-To: dev-commits-src-branches@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 4dt9G36yymz6Nlvj for ; Fri, 16 Jan 2026 19:41:31 +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 4dt9G32m39z3y8K for ; Fri, 16 Jan 2026 19:41:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768592491; 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=0F5woW5fY51dQOun4rRURQ//mvpQggzJRZSAzbEzXKs=; b=HwWp5amS8GGn5ZRI0MFNo/VqLvWEWUuFqIzaW8oqBuFYiRm3BVOjUm1iMSw9L2ugLYrhaZ SRexneHMmixq2MZyKYD0DO3O1tXQs8sWJU2ltoatJD4nAzvNZnrqE0cnPT8GLwqS6b6+8W JugyqpFnlJ6mCXmAhr+1QwpEwOdjm/XM+v6hWvmGKY3gagVQv4lKBgVtJb7Hfcj6+vzBYy LwwI4j0tps81GRlsFoeioEndQBnsdcb6qrD3tQmeaXAtWCmwwsha7FH8J6D2umpFruKy4T Ic0k0f5nCIayF7EsLYqSU4P9Lqn7keRCkXqF3Lw/1ShJWHfLiEhDo2842Br0Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768592491; 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=0F5woW5fY51dQOun4rRURQ//mvpQggzJRZSAzbEzXKs=; b=V3dR5mVDHcrLBXU30dJuZTznd57yMfeSYU1/gVb1MS4YubqjZpshagIBK6bGBaRq4xksfy beYNb9g1mnCPsbV2GMzaU1Q6BBX1CICfW3jaRbpZjpv5RgjerrI+Vb8VJrqqhkTF5Xu3e9 QaIh3WIoR8X7Mp+/n8iCeOUzAW5OLK3oBLvfdllZhs4kb7VB7vkxKT3jmHPmXHfMhjTgDA aP2JnXULTBEETG9/LOoHcAALX7Fl/D3dbJhDcRpkh925jVf9Mwlsl+QmghdqXEFvmhBdsM pu1elHa53jvky7ZVBG0ujozPDBC/YJX0E9nQMe1d7vlEegKxlz3Yn000PWjkPA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768592491; a=rsa-sha256; cv=none; b=tFJbY3lhN8LZd4uHpV4feSWTXLjBAOs2g86wQfzWhkg/WwT4ZoL05t9oCjy/DA/AvN08KD gzUOWsRrONv0XEZ9dqx0Hj/uINdJODm0ZopgsF9ukmmXolMBkRIh+k/H9l8+BmIiq4kJuA 8YzMwYapY1imQIm1iVfOYc9RXwomvRtULWoBTYMF5jCGx5UTJGSdqdKTGWKJGgy/BNgTVq jPkzs8/EuwACk0RE1dfUH/0nUMkFd8hqIv8bjpSa1S30i5sPa2MoTQPLnMZZNAEzqdGQbj t9FtDqIyI7cRGcE7dQa4pJgrqObQdgZWRaw84BCGzNQLzrkKZ9fBfi2bXzUzKQ== 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 4dt9G329XwzCfC for ; Fri, 16 Jan 2026 19:41:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id de20 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 16 Jan 2026 19:41:31 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 3fc5eb05910f - stable/14 - sys/bitcount.h: add __const_bitcount List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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/14 X-Git-Reftype: branch X-Git-Commit: 3fc5eb05910f0377e661c0ed57842baa1642b237 Auto-Submitted: auto-generated Date: Fri, 16 Jan 2026 19:41:31 +0000 Message-Id: <696a946b.de20.4b1ba44e@gitrepo.freebsd.org> The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3fc5eb05910f0377e661c0ed57842baa1642b237 commit 3fc5eb05910f0377e661c0ed57842baa1642b237 Author: Bjoern A. Zeeb AuthorDate: 2025-09-15 23:54:57 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-01-16 19:37:55 +0000 sys/bitcount.h: add __const_bitcount Add a version of __const_bitcount which can be used to get the numbers at compile-time when __builtin_popcountg() is not available (see sys/compat/linuxkpi/common/include/linux/bitops.h for LLVM before 19 and gcc before 14). Obtained from: https://reviews.freebsd.org/D50995#1174884 by obiwac Sponsored by: The FreeBSD Foundation Reviewed by: brooks, emaste Differential Revision: https://reviews.freebsd.org/D54301 (cherry picked from commit 27aa23cee81088b0ffa974eec9f03c654c36438e) (cherry picked from commit 605389e40b938088718bd8aa75f4919884789927) --- sys/sys/bitcount.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sys/sys/bitcount.h b/sys/sys/bitcount.h index aaa85c38d2e3..dfbba70f4d6a 100644 --- a/sys/sys/bitcount.h +++ b/sys/sys/bitcount.h @@ -41,6 +41,28 @@ #include +#define __const_bitcount8(x) ( \ + !!((x) & (1 << 0)) + \ + !!((x) & (1 << 1)) + \ + !!((x) & (1 << 2)) + \ + !!((x) & (1 << 3)) + \ + !!((x) & (1 << 4)) + \ + !!((x) & (1 << 5)) + \ + !!((x) & (1 << 6)) + \ + !!((x) & (1 << 7))) + +#define __const_bitcount16(x) ( \ + __const_bitcount8(x) + \ + __const_bitcount8((x) >> 8)) + +#define __const_bitcount32(x) ( \ + __const_bitcount16(x) + \ + __const_bitcount16((x) >> 16)) + +#define __const_bitcount64(x) ( \ + __const_bitcount32(x) + \ + __const_bitcount32((x) >> 32)) + #ifdef __POPCNT__ #define __bitcount64(x) __builtin_popcountll((__uint64_t)(x)) #define __bitcount32(x) __builtin_popcount((__uint32_t)(x))