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

stdc_bit_floor, stdc_bit_floor_uc, stdc_bit_floor_us, stdc_bit_floor_ui, stdc_bit_floor_ul, stdc_bit_floor_ullfind largest power of 2 smaller than value

#include <sys/stdbit.h>

generic_value_type
stdc_bit_floor(generic_value_type value);

unsigned char
stdc_bit_floor_uc(unsigned char value);

unsigned short
stdc_bit_floor_us(unsigned short value);

unsigned int
stdc_bit_floor_ui(unsigned int value);

unsigned long
stdc_bit_floor_ul(unsigned long value);

unsigned long long
stdc_bit_floor_ull(unsigned long long value);

The () family of functions determine the largest power of 2 that is not greater than value. If value is 0, then the function returns 0.

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_bit_floor() family returns the largest power of 2 that is not greater than value. These functions cannot fail.

stdc_bit_floor(3C), stdc_bit_ceil(9F), stdc_bit_width(9F), stdc_count_ones(9F), stdc_count_zero(9F), stdc_first_leading_one(9F), stdc_first_leading_zero(9F), stdc_first_trailing_one(9F), stdc_first_trailing_zero(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