STDC_TRAILING_ZEROS(3)

NAME
stdc_trailing_zeros - find the number of trailing zeros in an integer

SYNOPSIS
libc
#include <stdbit.h>
unsigned int
stdc_trailing_zeros_uc(unsigned char value);
unsigned int
stdc_trailing_zeros_us(unsigned short value);
unsigned int
stdc_trailing_zeros_ui(unsigned int value);
unsigned int
stdc_trailing_zeros_ul(unsigned long value);
unsigned int
stdc_trailing_zeros_ull(unsigned long long value);
unsigned int
stdc_trailing_zeros(value);

DESCRIPTION
The stdc_trailing_zeros_type() family of functions returns the number of trailing zeros in value, where value is of type unsigned char, unsigned short, unsigned int, unsigned long, or unsigned long long for type being uc, us, ui, ul, or ull respectively. The stdc_trailing_zeros(value) type-generic macro picks the appropriate stdc_trailing_zeros_type() function based on the type of value.

RETURN VALUES
Returns the number of trailing zeros in value. If value is all zeros, the total number of bits in the type of value is returned.

SEE ALSO
ffs(3), stdbit(3), stdc_leading_zeros(3), stdc_trailing_ones(3), stdc_first_trailing_one(3)

STANDARDS
The stdc_trailing_zeros_type() family of functions and the stdc_trailing_zeros() type-generic macro conform to isoC-2023.

HISTORY
The stdc_trailing_zeros_type() family of functions and the stdc_trailing_zeros() type-generic macro were added in FreeBSD 15.1.

AUTHOR
Robert Clausecker <fuz@FreeBSD.org>