summaryrefslogtreecommitdiff
path: root/static/freebsd/man3/stdc_first_trailing_one.3
diff options
context:
space:
mode:
Diffstat (limited to 'static/freebsd/man3/stdc_first_trailing_one.3')
-rw-r--r--static/freebsd/man3/stdc_first_trailing_one.3110
1 files changed, 110 insertions, 0 deletions
diff --git a/static/freebsd/man3/stdc_first_trailing_one.3 b/static/freebsd/man3/stdc_first_trailing_one.3
new file mode 100644
index 00000000..0b590ac3
--- /dev/null
+++ b/static/freebsd/man3/stdc_first_trailing_one.3
@@ -0,0 +1,110 @@
+.\"
+.\" Copyright (c) 2025 Robert Clausecker <fuz@FreeBSD.org>
+.\"
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
+.Dd November 9, 2025
+.Dt STDC_FIRST_TRAILING_ONE 3
+.Os
+.Sh NAME
+.Nm stdc_first_trailing_one
+.Nd find the first trailing one in an integer
+.Sh SYNOPSIS
+.Lb libc
+.In stdbit.h
+.Ft unsigned int
+.Fn stdc_first_trailing_one_uc "unsigned char value"
+.Ft unsigned int
+.Fn stdc_first_trailing_one_us "unsigned short value"
+.Ft unsigned int
+.Fn stdc_first_trailing_one_ui "unsigned int value"
+.Ft unsigned int
+.Fn stdc_first_trailing_one_ul "unsigned long value"
+.Ft unsigned int
+.Fn stdc_first_trailing_one_ull "unsigned long long value"
+.Ft unsigned int
+.Fn stdc_first_trailing_one "value"
+.Sh DESCRIPTION
+The
+.Nm stdc_first_trailing_one_ Ns Em type Ns ()
+family of functions returns the index of the least significant set bit in
+.Fa 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.
+The
+.Fn stdc_first_trailing_one "value"
+type-generic macro picks the appropriate
+.Nm stdc_first_trailing_one_ Ns Em type Ns ()
+function based on the type of
+.Fa value .
+.Pp
+Functions
+.Fn stdc_first_trailing_one_ui ,
+.Fn stdc_first_trailing_one_ul ,
+and
+.Fn stdc_first_trailing_one_ull
+are identical to
+.Bx 4.3
+functions
+.Xr ffs 3 ,
+.Xr ffsl 3 ,
+and
+.Xr ffsll 3
+respectively, except for operating on unsigned instead of signed values.
+.Sh RETURN VALUES
+Returns the index of the least significant set bit in
+.Fa value .
+The bits are numbered such that the least significant bit has number\~1,
+and the most significant bit has number
+.Ms w
+where
+.Ms w
+is the number of bits in the type of
+.Fa value .
+If no bits are set in
+.Fa value
+(i.\^e.\&
+.Fa value
+is zero), one is returned.
+.Sh SEE ALSO
+.Xr bit_ffs 3 ,
+.Xr ffs 3 ,
+.Xr ffsl 3 ,
+.Xr ffsll 3 ,
+.Xr stdbit 3 ,
+.Xr stdc_trailing_zeros 3 ,
+.Xr stdc_first_trailing_zero 3 ,
+.Xr stdc_first_leading_one 3
+.Sh STANDARDS
+The
+.Nm stdc_first_trailing_one_ Ns Em type Ns ()
+family of functions and the
+.Fn stdc_first_trailing_one
+type-generic macro conform to
+.St -isoC-2023 .
+.Sh HISTORY
+The
+.Nm stdc_first_trailing_one_ Ns Em type Ns ()
+family of functions and the
+.Fn stdc_first_trailing_one
+type-generic macro were added in
+.Fx 15.1.
+.Sh AUTHOR
+.An Robert Clausecker Aq Mt fuz@FreeBSD.org