From nobody Thu Jan 1 22:21:44 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 4dj1Wr640gz6Mnn7 for ; Thu, 01 Jan 2026 22:21:44 +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 4dj1Wr3yLqz4B1v for ; Thu, 01 Jan 2026 22:21:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767306104; 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=onEgPzAQ51MelLciw/E3WlrBeU4G+1cYLN1LtDTophc=; b=qe5ogEVMrLHuLK3loHha6KL3UoVdqLD9JiiAYfXwhwrHGJ7El2YQ5ncphKwHGTyF3OHFr/ TAOTeoKB9Q4Ncz9kIvJsy0fuiC/Fj+Ro6rt2BZzax5D6Kpmb5kqp/jNPLo+VAzRbKC1IvD LOQOvV9758D693LqTtlt9k6MqgwpuZjp58VZv7vepzOz4v/akmYQp9Z2aFWEhuv15MVBsG JiulijTMCrzsZO8GK5gWaruXJeawWkVHUT2HvolnN1qiBPuUI6J7rfF4tiPGlU8ziMtnge IHYOaqj7m6RR19crWFoVM+77WjC9hO8EYfc2s5I7pycuwvQ9lINyNDUO8b4H/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767306104; 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=onEgPzAQ51MelLciw/E3WlrBeU4G+1cYLN1LtDTophc=; b=lCiU5RKrFZolshysUKcbJf8PKpC5xFXqQ9sBL3Y6J86VzntMJ6bPV1AOD18GdOBt2sv5k+ 1N/jeX4rK2Nm6f0TqDvWKfffhez02xQcbWCOh3fvrlnHrfR3aTINJbMftiAazzJbMD8x8f 8aLswOUjzumz28c0PyLpV9xQfti0ZHVn476lOQIIhPWnGnbLL2tCZo8UfA+S29Mqccs1VL svzGFIhlk/4uhFAn0qOv5jkn2LyFjlyoKpToOdb+ppSgvlJ3ZeE3TjC8DoUYAmkzPcNPMh Zpj+tWjH/R1bCWsX3ZmO7MVN71NN8xp+LJZUKb7dJkCOSdPFEY2BlGsUIta0VQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1767306104; a=rsa-sha256; cv=none; b=R7nauLjH7hT6be5GLTu8TD/jeNu/ECavWWW5I08q7LOnfIKF52EFiRjTSUDSo3skio9y7e te1OJtvQxso2nOCMjClz7LILmu+QINnQX5tt9d4b0cQf8CeGxGUVLP0TISzHFpRtNmNgMW CqnU2SzmavCFPXm++Pb+crAhaYVcJvXp9tGfBjLkYudsfGs2PFpCoP26Hzzy75vIsDbUip UXY6hjlEvHtvsUrsyIQJBk2qdQ8jgs2vNF8Kmc3rRyajzfC/Y3ITXuuYjL6t9AeN49SSC7 CmafVWSwUpp5eZQFXVLG4vDgUFNFmlDY3c05s4yN6nQih0gcr9wfbjh47s/hzw== 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 4dj1Wr3BXCzqZf for ; Thu, 01 Jan 2026 22:21:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id f483 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 01 Jan 2026 22:21:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Robert Clausecker Subject: git: 6b7ed283d4b4 - stable/15 - man/man3: add stdbit.3 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: fuz X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 6b7ed283d4b40c4e17c35e2581b9c2329c8669b6 Auto-Submitted: auto-generated Date: Thu, 01 Jan 2026 22:21:44 +0000 Message-Id: <6956f378.f483.58110c29@gitrepo.freebsd.org> The branch stable/15 has been updated by fuz: URL: https://cgit.FreeBSD.org/src/commit/?id=6b7ed283d4b40c4e17c35e2581b9c2329c8669b6 commit 6b7ed283d4b40c4e17c35e2581b9c2329c8669b6 Author: Robert Clausecker AuthorDate: 2025-11-18 17:33:04 +0000 Commit: Robert Clausecker CommitDate: 2026-01-01 20:57:32 +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 (cherry picked from commit d39e310c7d6a42b459aa7919310e3c99cc478d50) --- 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 bce57291f073..8e4aadc460a6 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..bdee56cc8013 --- /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 +.An Robert Clausecker Aq Mt fuz@FreeBSD.org