stdc_trailing_ones3
Find the number of trailing ones in an integer
Usage
Standard C Library (libc, -lc)
#include <stdbit.h>
unsigned int
stdc_trailing_ones_uc(unsigned char value);
unsigned int
stdc_trailing_ones_us(unsigned short value);
unsigned int
stdc_trailing_ones_ui(unsigned int value);
unsigned int
stdc_trailing_ones_ul(unsigned long value);
unsigned int
stdc_trailing_ones_ull(unsigned long long value);
unsigned int
stdc_trailing_ones(value);
Overview
The stdc_trailing_ones_type() family of functions returns the number of trailing ones 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_ones(value) type-generic macro picks the appropriate stdc_trailing_ones_type() function based on the type of value.
Return values
Returns the number of trailing ones in value. If value is all ones, the total number of bits in the type of value is returned.
Releases
2 releases since FreeBSD 15.1-RELEASE; the text changed 1 time.