STDC_FIRST_TRAILING_ZERO(9F) Kernel Functions for Drivers STDC_FIRST_TRAILING_ZERO(9F)

stdc_first_trailing_zero, stdc_first_trailing_zero_uc, stdc_first_trailing_zero_us, stdc_first_trailing_zero_ui, stdc_first_trailing_zero_ul, stdc_first_trailing_zero_ullfind index of least significant zero bit

#include <sys/stdbit.h>

unsigned int
stdc_first_trailing_zero(generic_value_type value);

unsigned int
stdc_first_trailing_zero_uc(unsigned char value);

unsigned int
stdc_first_trailing_zero_us(unsigned short value);

unsigned int
stdc_first_trailing_zero_ui(unsigned int value);

unsigned int
stdc_first_trailing_zero_ul(unsigned long value);

unsigned int
stdc_first_trailing_zero_ull(unsigned long long value);

The () family of functions returns the 1s-based index of the first zero bit in value starting at the least significant bit. If there is no zero bit in value then zero is returned.

The () function is generic and will operate on all 8, 16, 32, and 64-bit unsigned integers; however, it is only available in C23. The other functions all operate on a specific integer type, but otherwise behave the same and are available regardless of the C language version.

These functions may be called from , , or context.

The functions in the stdc_first_trailing_zero() family always return the index of the first trailing zero bit in value plus one. Otherwise, if there are no zero bits in value, 0 will be returned. These functions cannot fail.

stdc_first_trailing_zero(3C), stdc_bit_ceil(9F), stdc_bit_floor(9F), stdc_bit_width(9F), stdc_count_ones(9F), stdc_count_zeros(9F), stdc_first_leading_one(9F), stdc_first_leading_zero(9F), stdc_first_trailing_one(9F), stdc_has_single_bit(9F), stdc_leading_ones(9F), stdc_leading_zeros(9F), stdc_trailing_ones(9F), stdc_trailing_zeros(9F)

October 27, 2024 OmniOS