标准库头文件 <stdbit.h> (C23)
来自 cppreference.cn
此头文件是数值库的一部分,特别是,它提供了用于处理 C 对象的字节序和字节和位表示的宏和函数。
函数 | |
(C23) |
计算从最高有效位开始的连续 0 位数量 (类型泛型函数宏) |
(C23) |
计算从最高有效位开始的连续 1 位数量 (类型泛型函数宏) |
(C23) |
计算从最低有效位开始的连续 0 位数量 (类型泛型函数宏) |
(C23) |
计算从最低有效位开始的连续 1 位数量 (类型泛型函数宏) |
查找从最高有效位开始的第一个 0 位的位置 (类型泛型函数宏) | |
查找从最高有效位开始的第一个 1 位的位置 (类型泛型函数宏) | |
查找从最低有效位开始的第一个 0 位的位置 (类型泛型函数宏) | |
查找从最低有效位开始的第一个 1 位的位置 (类型泛型函数宏) | |
(C23) |
计算无符号整数中 0 位的数量 (类型泛型函数宏) |
(C23) |
计算无符号整数中 1 位的数量 (类型泛型函数宏) |
(C23) |
检查一个数字是否为 2 的整数次幂 (类型泛型函数宏) |
(C23) |
查找表示给定值所需的最小位数 (类型泛型函数宏) |
(C23) |
查找不大于给定值的最大 2 的整数次幂 (类型泛型函数宏) |
(C23) |
查找不小于给定值的最小 2 的整数次幂 (类型泛型函数宏) |
宏常量 | |
指示标量类型的字节序 (宏常量) |
[编辑] 概要
#define __STDC_VERSION_STDBIT_H__ 202311L #define __STDC_ENDIAN_LITTLE__ /* implementation-defined */ #define __STDC_ENDIAN_BIG__ /* implementation-defined */ #define __STDC_ENDIAN_NATIVE__ /* implementation-defined */ unsigned int stdc_leading_zeros_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_leading_zeros_us(unsigned short value) [[unsequenced]]; unsigned int stdc_leading_zeros_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_leading_zeros_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_leading_zeros_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_leading_zeros(/*generic_value_type*/ value) [[unsequenced]]; unsigned int stdc_leading_ones_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_leading_ones_us(unsigned short value) [[unsequenced]]; unsigned int stdc_leading_ones_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_leading_ones_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_leading_ones_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_leading_ones(/*generic_value_type*/ value) [[unsequenced]]; unsigned int stdc_trailing_zeros_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_trailing_zeros_us(unsigned short value) [[unsequenced]]; unsigned int stdc_trailing_zeros_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_trailing_zeros_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_trailing_zeros_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_trailing_zeros(/*generic_value_type*/ value) [[unsequenced]]; unsigned int stdc_trailing_ones_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_trailing_ones_us(unsigned short value) [[unsequenced]]; unsigned int stdc_trailing_ones_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_trailing_ones_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_trailing_ones_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_trailing_ones(/*generic_value_type*/ value) [[unsequenced]]; unsigned int stdc_first_leading_zero_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_first_leading_zero_us(unsigned short value) [[unsequenced]]; unsigned int stdc_first_leading_zero_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_first_leading_zero_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_first_leading_zero_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_first_leading_zero(/*generic_value_type*/ value) [[unsequenced]]; unsigned int stdc_first_leading_one_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_first_leading_one_us(unsigned short value) [[unsequenced]]; unsigned int stdc_first_leading_one_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_first_leading_one_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_first_leading_one_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_first_leading_one(/*generic_value_type*/ value) [[unsequenced]]; unsigned int stdc_first_trailing_zero_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_first_trailing_zero_us(unsigned short value) [[unsequenced]]; unsigned int stdc_first_trailing_zero_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_first_trailing_zero_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_first_trailing_zero_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_first_trailing_zero(/*generic_value_type*/ value) [[unsequenced]]; unsigned int stdc_first_trailing_one_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_first_trailing_one_us(unsigned short value) [[unsequenced]]; unsigned int stdc_first_trailing_one_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_first_trailing_one_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_first_trailing_one_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_first_trailing_one(/*generic_value_type*/ value) [[unsequenced]]; unsigned int stdc_count_zeros_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_count_zeros_us(unsigned short value) [[unsequenced]]; unsigned int stdc_count_zeros_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_count_zeros_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_count_zeros_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_count_zeros(/*generic_value_type*/ value) [[unsequenced]]; unsigned int stdc_count_ones_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_count_ones_us(unsigned short value) [[unsequenced]]; unsigned int stdc_count_ones_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_count_ones_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_count_ones_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_count_ones(/*generic_value_type*/ value) [[unsequenced]]; bool stdc_has_single_bit_uc(unsigned char value) [[unsequenced]]; bool stdc_has_single_bit_us(unsigned short value) [[unsequenced]]; bool stdc_has_single_bit_ui(unsigned int value) [[unsequenced]]; bool stdc_has_single_bit_ul(unsigned long int value) [[unsequenced]]; bool stdc_has_single_bit_ull(unsigned long long int value) [[unsequenced]]; bool stdc_has_single_bit(/*generic_value_type*/ value) [[unsequenced]]; unsigned int stdc_bit_width_uc(unsigned char value) [[unsequenced]]; unsigned int stdc_bit_width_us(unsigned short value) [[unsequenced]]; unsigned int stdc_bit_width_ui(unsigned int value) [[unsequenced]]; unsigned int stdc_bit_width_ul(unsigned long int value) [[unsequenced]]; unsigned int stdc_bit_width_ull(unsigned long long int value) [[unsequenced]]; /*generic_return_type*/ stdc_bit_width(/*generic_value_type*/ value) [[unsequenced]]; unsigned char stdc_bit_floor_uc(unsigned char value) [[unsequenced]]; unsigned short stdc_bit_floor_us(unsigned short value) [[unsequenced]]; unsigned int stdc_bit_floor_ui(unsigned int value) [[unsequenced]]; unsigned long int stdc_bit_floor_ul(unsigned long int value) [[unsequenced]]; unsigned long long int stdc_bit_floor_ull(unsigned long long int value) [[unsequenced]]; /*generic_value_type*/ stdc_bit_floor(/*generic_value_type*/ value) [[unsequenced]]; unsigned char stdc_bit_ceil_uc(unsigned char value) [[unsequenced]]; unsigned short stdc_bit_ceil_us(unsigned short value) [[unsequenced]]; unsigned int stdc_bit_ceil_ui(unsigned int value) [[unsequenced]]; unsigned long int stdc_bit_ceil_ul(unsigned long int value) [[unsequenced]]; unsigned long long int stdc_bit_ceil_ull(unsigned long long int value) [[unsequenced]]; /*generic_value_type*/ stdc_bit_ceil(/*generic_value_type*/ value) [[unsequenced]]; unsigned char stdc_rotate_left_uc(unsigned char value, unsigned int count); unsigned short stdc_rotate_left_us(unsigned short value, unsigned int count); unsigned int stdc_rotate_left_ui(unsigned int value, unsigned int count); unsigned long stdc_rotate_left_ul(unsigned long value, unsigned int count); unsigned long long stdc_rotate_left_ull(unsigned long long value, unsigned int count); /*generic_value_type*/ stdc_rotate_left(/*generic_value_type*/ value, generic_count_type count); unsigned char stdc_rotate_right_uc(unsigned char value, unsigned int count); unsigned short stdc_rotate_right_us(unsigned short value, unsigned int count); unsigned int stdc_rotate_right_ui(unsigned int value, unsigned int count); unsigned long stdc_rotate_right_ul(unsigned long value, unsigned int count); unsigned long long stdc_rotate_right_ull(unsigned long long value, unsigned int count); /*generic_value_type*/ stdc_rotate_right(/*generic_value_type*/ value, generic_count_type count);