From nobody Sun Nov 30 19:22:12 2025 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 4dKH3T2dxBz6Jh63 for ; Sun, 30 Nov 2025 19:22:13 +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" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dKH3S6btGz3gQF for ; Sun, 30 Nov 2025 19:22:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764530533; 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=ijxCfLo/t9tGGoFLv0lNOGqZWtEbQXWMZKvRSqmgiPw=; b=BxlUZy4McEOFhcdaRuxtWb15qU9YNi7RmZQXW7eTatB/6xwQlitA3ISdXcyj34UBcbjsCJ r6YB41lhEqXS+Jawd/LWZixiO+7ju3Knrs/MF96+UNNBzTcMgEAV6UKEUlS6mGGGQlrURc LTlG1IudSwixmMfhbnx/Rz4aB8OTA1TMpc2oOmYGXO8fZZZq3g7fP5i9fvxCJJH3XF2gk7 OsNDFrI1xVjvAWXYdu3qyMy3b+hZC8zRWpq7l5vrzSPBikA3fYhZZ1f3UDd394RxL7K410 3sczzFHnc2UyL7EyMwWxgKjUmBtBfShBFYIKiBSSlbSO6MzRzkcP1FsNUAdovQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1764530533; 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=ijxCfLo/t9tGGoFLv0lNOGqZWtEbQXWMZKvRSqmgiPw=; b=lGRYXPfd7S0WiIo0daXh+i3Ew8wZseFCrmCAFIRLbcnU+m7QBNqivw8v+Wzbnl5XPPBGXp GIupB8kNnDN27qw/gMNsLStJCHa8SkDLGIvghcfQ3o+PlYuh6F8pfmByy96WLHcydPF40/ gXZTN2fJbDYqHBMhBbwvuXrV6+8of+Kpm2qk9OORfC/HTsnvHrXSQ6nEmmqQyM77xq4VHS pi6AfpAbMOICUSSfvruMHaz3Rm4cnvY1IyGN551HrVV+na1SlrceV0Zq0kUyV6EyAvFbJK PXy7+KMPSXGiIx3HDCZp216auIY26ihTWqmRkhVCtKC1m1XMjWh5kuabYsqGeQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1764530533; a=rsa-sha256; cv=none; b=h08u5CGJYW37wbT0LZqzSWyy+kopFhwd+SLvBhjjtvLHnrJN/zMQdJHPc31DH7ImFgPdsU jgocx85Hy/7t3NyxKOSNoRXzItb/Ujl51RZ3pZiGblEv+KGYx3uVXWfajmyuOt819+lKjF ekJQBDphHEBogC+1cyFaPtT+gSuly0YkGd6Yuj9W8pWW/I6lKVqSOOqUq4SlKosffk0Fil +/kWurHXiQOmsSceh+dYBzJJOnt8D+AntLZ0wSv7gxRt5x9ZNNA9deZQJDPDeSRInDLL7/ 7/JLjxst2X7tWBuzZS20ogkXhJYO6rG8SKMH39RlmbHR7LCa8ENqp4zGVEmDgA== 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 4dKH3S5ZBtzp5P for ; Sun, 30 Nov 2025 19:22:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 265f5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 30 Nov 2025 19:22:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Clausecker Subject: git: d39e310c7d6a - main - man/man3: add stdbit.3 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d39e310c7d6a42b459aa7919310e3c99cc478d50 Auto-Submitted: auto-generated Date: Sun, 30 Nov 2025 19:22:12 +0000 Message-Id: <692c9964.265f5.3c429860@gitrepo.freebsd.org> The branch main has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=d39e310c7d6a42b459aa7919310e3c99cc478d50 commit d39e310c7d6a42b459aa7919310e3c99cc478d50 Author: Robert Clausecker AuthorDate: 2025-11-18 17:33:04 +0000 Commit: Robert Clausecker CommitDate: 2025-11-30 19:21:52 +0000 man/man3: add stdbit.3 This is the overview man page for the functions. Reviewed by: pauamma@gundo.com, adrian Approved by: markj (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53658 --- share/man/man3/Makefile | 1 + share/man/man3/stdbit.3 | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index e5e790194ffc..3fd819814f77 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -31,6 +31,7 @@ MAN= alloca.3 \ snl.3 \ stats.3 \ stdarg.3 \ + stdbit.3 \ stdckdint.3 \ sysexits.3 \ tgmath.3 \ diff --git a/share/man/man3/stdbit.3 b/share/man/man3/stdbit.3 new file mode 100644 index 000000000000..ec647fea4a7f --- /dev/null +++ b/share/man/man3/stdbit.3 @@ -0,0 +1,120 @@ +.\" +.\" Copyright (c) 2025 Robert Clausecker +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd November 9, 2025 +.Dt STDBIT 3 +.Os +.Sh NAME +.Nm stdbit +.Nd bit and byte utilities +.Sh SYNOPSIS +.Lb libc +.In stdbit.h +.Fd #define __STDC_ENDIAN_LITTLE__ +.Fd #define __STDC_ENDIAN_BIG__ +.Fd #define __STDC_ENDIAN_NATIVE__ +.Ft unsigned int +.Fn stdc_count_leading_zeros "value" +.Ft unsigned int +.Fn stdc_count_leading_ones "value" +.Ft unsigned int +.Fn stdc_count_trailing_zeros "value" +.Ft unsigned int +.Fn stdc_count_trailing_ones "value" +.Ft unsigned int +.Fn stdc_first_leading_zero "value" +.Ft unsigned int +.Fn stdc_first_leading_one "value" +.Ft unsigned int +.Fn stdc_first_trailing_zero "value" +.Ft unsigned int +.Fn stdc_first_trailing_one "value" +.Ft unsigned int +.Fn stdc_count_zeros "value" +.Ft unsigned int +.Fn stdc_count_ones "value" +.Ft bool +.Fn stdc_has_single_bit "value" +.Ft unsigned int +.Fn stdc_bit_width "value" +.Ft typeof Ns Pq Em value +.Fn stdc_bit_floor "value" +.Ft typeof Ns Pq Em value +.Fn stdc_bit_ceil "value" +.Sh DESCRIPTION +The +.Dv __STDC_ENDIAN_NATIVE__ +macro describes the byte order or endianness of the machine for which the +program is built. +If the machine has big-endian byte order, this macro is equal to +.Dv __STDC_ENDIAN_BIG__ . +If the machine has little-endian byte order, this macro is equal to +.Dv __STDC_ENDIAN_LITTLE__ . +Otherwise, the macro has a value that is equal to neither. +.Pp +The bit and byte utility functions analyze the bits within a datum. +Each function +.Em func +is provided in five variants +.Nm stdc_ Ns Em func Ns Em _ Ns Em type Ns Pq Em value +where +.Fa value +is of type +.Va unsigned char , +.Va unsigned short , +.Va unsigned int , +.Va unsigned long , +or +.Va unsigned long long +for +.Em type +being +.Sy uc , +.Sy us , +.Sy ui , +.Sy ul , +or +.Sy ull +respectively. +Additionally, for each +.Em func , +a type-generic macro +.Nm stdc_ Ns Em func Ns Pq Em value +that picks the appropriate function +.Nm stdc_ Ns Em func Ns Em _ Ns Em type Ns Pq Em value +based on the type of +.Fa value +is provided. +.Sh SEE ALSO +.Xr arch 7 , +.Xr bitstring 3 , +.Xr ffs 3 , +.Xr fls 3 , +.Xr stdc_count_leading_zeros 3 , +.Xr stdc_count_leading_ones 3 , +.Xr stdc_count_trailing_zeros 3 , +.Xr stdc_count_trailing_ones 3 , +.Xr stdc_first_leading_zero 3 , +.Xr stdc_first_leading_one 3 , +.Xr stdc_first_trailing_zero 3 , +.Xr stdc_first_trailing_one 3 , +.Xr stdc_count_zeros 3 , +.Xr stdc_count_ones 3 , +.Xr stdc_has_single_bit 3 , +.Xr stdc_bit_width 3 , +.Xr stdc_bit_floor 3 , +.Xr stdc_bit_ceil 3 +.Sh STANDARDS +The macros and functions of the +.In stdbit.h +header conform to +.St -isoC-2023 . +.Sh HISTORY +The +.In stdbit.h +header and the macros and functions defined therein where added in +.Fx 15.1. +.Sh AUTHOR +.Ah Robert Clausecker Aq Mt fuz@FreeBSD.org