int
__builtin_ffs (int x)
¶Returns one plus the index of the least significant 1-bit of x, or if x is zero, returns zero.
int
__builtin_clz (unsigned int x)
¶Returns the number of leading 0-bits in x, starting at the most significant bit position. If x is 0, the result is undefined.
int
__builtin_ctz (unsigned int x)
¶Returns the number of trailing 0-bits in x, starting at the least significant bit position. If x is 0, the result is undefined.
int
__builtin_clrsb (int x)
¶Returns the number of leading redundant sign bits in x, i.e. the number of bits following the most significant bit that are identical to it. There are no special cases for 0 or other values.
int
__builtin_popcount (unsigned int x)
¶Returns the number of 1-bits in x.
int
__builtin_parity (unsigned int x)
¶Returns the parity of x, i.e. the number of 1-bits in x modulo 2.
int
__builtin_ffsl (long)
¶Similar to __builtin_ffs
, except the argument type is
long
.
int
__builtin_clzl (unsigned long)
¶Similar to __builtin_clz
, except the argument type is
unsigned long
.
int
__builtin_ctzl (unsigned long)
¶Similar to __builtin_ctz
, except the argument type is
unsigned long
.
int
__builtin_clrsbl (long)
¶Similar to __builtin_clrsb
, except the argument type is
long
.
int
__builtin_popcountl (unsigned long)
¶Similar to __builtin_popcount
, except the argument type is
unsigned long
.
int
__builtin_parityl (unsigned long)
¶Similar to __builtin_parity
, except the argument type is
unsigned long
.
int
__builtin_ffsll (long long)
¶Similar to __builtin_ffs
, except the argument type is
long long
.
int
__builtin_clzll (unsigned long long)
¶Similar to __builtin_clz
, except the argument type is
unsigned long long
.
int
__builtin_ctzll (unsigned long long)
¶Similar to __builtin_ctz
, except the argument type is
unsigned long long
.
int
__builtin_clrsbll (long long)
¶Similar to __builtin_clrsb
, except the argument type is
long long
.
int
__builtin_popcountll (unsigned long long)
¶Similar to __builtin_popcount
, except the argument type is
unsigned long long
.
int
__builtin_parityll (unsigned long long)
¶Similar to __builtin_parity
, except the argument type is
unsigned long long
.
int
__builtin_ffsg (...)
¶Similar to __builtin_ffs
, except the argument is type-generic
signed integer (standard, extended or bit-precise). No integral argument
promotions are performed on the argument.
int
__builtin_clzg (...)
¶Similar to __builtin_clz
, except the argument is type-generic
unsigned integer (standard, extended or bit-precise) and there is
optional second argument with int type. No integral argument promotions
are performed on the first argument. If two arguments are specified,
and first argument is 0, the result is the second argument. If only
one argument is specified and it is 0, the result is undefined.
int
__builtin_ctzg (...)
¶Similar to __builtin_ctz
, except the argument is type-generic
unsigned integer (standard, extended or bit-precise) and there is
optional second argument with int type. No integral argument promotions
are performed on the first argument. If two arguments are specified,
and first argument is 0, the result is the second argument. If only
one argument is specified and it is 0, the result is undefined.
int
__builtin_clrsbg (...)
¶Similar to __builtin_clrsb
, except the argument is type-generic
signed integer (standard, extended or bit-precise). No integral argument
promotions are performed on the argument.
int
__builtin_popcountg (...)
¶Similar to __builtin_popcount
, except the argument is type-generic
unsigned integer (standard, extended or bit-precise). No integral argument
promotions are performed on the argument.
int
__builtin_parityg (...)
¶Similar to __builtin_parity
, except the argument is type-generic
unsigned integer (standard, extended or bit-precise). No integral argument
promotions are performed on the argument.
type
__builtin_stdc_bit_ceil (type arg)
¶The __builtin_stdc_bit_ceil
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
arg <= 1 ? (type) 1
: (type) 2 << (prec - 1 - __builtin_clzg ((type) (arg - 1)))
where prec is bit width of type, except that side-effects
in arg are evaluated just once.
type
__builtin_stdc_bit_floor (type arg)
¶The __builtin_stdc_bit_floor
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
arg == 0 ? (type) 0
: (type) 1 << (prec - 1 - __builtin_clzg (arg))
where prec is bit width of type, except that side-effects
in arg are evaluated just once.
unsigned int
__builtin_stdc_bit_width (type arg)
¶The __builtin_stdc_bit_width
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
(unsigned int) (prec - __builtin_clzg (arg, prec))
where prec is bit width of type.
unsigned int
__builtin_stdc_count_ones (type arg)
¶The __builtin_stdc_count_ones
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
(unsigned int) __builtin_popcountg (arg)
unsigned int
__builtin_stdc_count_zeros (type arg)
¶The __builtin_stdc_count_zeros
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
(unsigned int) __builtin_popcountg ((type) ~arg)
unsigned int
__builtin_stdc_first_leading_one (type arg)
¶The __builtin_stdc_first_leading_one
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
__builtin_clzg (arg, -1) + 1U
unsigned int
__builtin_stdc_first_leading_zero (type arg)
¶The __builtin_stdc_first_leading_zero
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
__builtin_clzg ((type) ~arg, -1) + 1U
unsigned int
__builtin_stdc_first_trailing_one (type arg)
¶The __builtin_stdc_first_trailing_one
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
__builtin_ctzg (arg, -1) + 1U
unsigned int
__builtin_stdc_first_trailing_zero (type arg)
¶The __builtin_stdc_first_trailing_zero
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
__builtin_ctzg ((type) ~arg, -1) + 1U
unsigned int
__builtin_stdc_has_single_bit (type arg)
¶The __builtin_stdc_has_single_bit
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
(_Bool) (__builtin_popcountg (arg) == 1)
unsigned int
__builtin_stdc_leading_ones (type arg)
¶The __builtin_stdc_leading_ones
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
(unsigned int) __builtin_clzg ((type) ~arg, prec)
unsigned int
__builtin_stdc_leading_zeros (type arg)
¶The __builtin_stdc_leading_zeros
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
(unsigned int) __builtin_clzg (arg, prec)
unsigned int
__builtin_stdc_trailing_ones (type arg)
¶The __builtin_stdc_trailing_ones
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
(unsigned int) __builtin_ctzg ((type) ~arg, prec)
unsigned int
__builtin_stdc_trailing_zeros (type arg)
¶The __builtin_stdc_trailing_zeros
function is available only
in C. It is type-generic, the argument can be any unsigned integer
(standard, extended or bit-precise). No integral argument promotions are
performed on the argument. It is equivalent to
(unsigned int) __builtin_ctzg (arg, prec)
type1
__builtin_stdc_rotate_left (type1 arg1, type2 arg2)
¶The __builtin_stdc_rotate_left
function is available only
in C. It is type-generic, the first argument can be any unsigned integer
(standard, extended or bit-precise) and second argument any signed or
unsigned integer or char
. No integral argument promotions are
performed on the arguments. It is equivalent to
(type1) ((arg1 << (arg2 % prec))
| (arg1 >> ((-(unsigned type2) arg2) % prec)))
where prec is bit width of type1, except that side-effects
in arg1 and arg2 are evaluated just once. The behavior is
undefined if arg2 is negative.
type1
__builtin_stdc_rotate_right (type1 arg1, type2 arg2)
¶The __builtin_stdc_rotate_right
function is available only
in C. It is type-generic, the first argument can be any unsigned integer
(standard, extended or bit-precise) and second argument any signed or
unsigned integer or char
. No integral argument promotions are
performed on the arguments. It is equivalent to
(type1) ((arg1 >> (arg2 % prec))
| (arg1 << ((-(unsigned type2) arg2) % prec)))
where prec is bit width of type1, except that side-effects
in arg1 and arg2 are evaluated just once. The behavior is
undefined if arg2 is negative.