/** Returns the count of consecutive 0 bits, starting from the most-significant. */ #define stdc_leading_zeros_uc(__x) stdc_leading_zeros((unsignedchar) (__x)) /** Returns the count of consecutive 0 bits, starting from the most-significant. */ #define stdc_leading_zeros_us(__x) stdc_leading_zeros((unsignedshort) (__x)) /** Returns the count of consecutive 0 bits, starting from the most-significant. */ #define stdc_leading_zeros_ui(__x) stdc_leading_zeros((unsignedint) (__x)) /** Returns the count of consecutive 0 bits, starting from the most-significant. */ #define stdc_leading_zeros_ul(__x) stdc_leading_zeros((unsignedlong) (__x)) /** Returns the count of consecutive 0 bits, starting from the most-significant. */ #define stdc_leading_zeros_ull(__x) stdc_leading_zeros((unsignedlonglong) (__x)) /** Returns the count of consecutive 0 bits, starting from the most-significant. */ #define stdc_leading_zeros(__x) \
((unsignedint) __builtin_clzg(__x, (int) (8 * sizeof(__x))))
/* C23 7.18.4 Count Leading Ones */
/** Returns the count of consecutive 1 bits, starting from the most-significant. */ #define stdc_leading_ones_uc(__x) stdc_leading_ones((unsignedchar) (__x)) /** Returns the count of consecutive 1 bits, starting from the most-significant. */ #define stdc_leading_ones_us(__x) stdc_leading_ones((unsignedshort) (__x)) /** Returns the count of consecutive 1 bits, starting from the most-significant. */ #define stdc_leading_ones_ui(__x) stdc_leading_ones((unsignedint) (__x)) /** Returns the count of consecutive 1 bits, starting from the most-significant. */ #define stdc_leading_ones_ul(__x) stdc_leading_ones((unsignedlong) (__x)) /** Returns the count of consecutive 1 bits, starting from the most-significant. */ #define stdc_leading_ones_ull(__x) stdc_leading_ones((unsignedlonglong) (__x)) /** Returns the count of consecutive 1 bits, starting from the most-significant. */ #define stdc_leading_ones(__x) \
((unsignedint) (__builtin_clzg(~(((unsignedlonglong) (__x)) << ((8 * sizeof(unsignedlonglong)) - (8 * sizeof(__x)))), \
(int) (8 * sizeof(__x)))))
/* C23 7.18.5 Count Trailing Zeros */
/** Returns the count of consecutive 0 bits, starting from the least-significant. */ #define stdc_trailing_zeros_uc(__x) stdc_trailing_zeros((unsignedchar) (__x)) /** Returns the count of consecutive 0 bits, starting from the least-significant. */ #define stdc_trailing_zeros_us(__x) stdc_trailing_zeros((unsignedshort) (__x)) /** Returns the count of consecutive 0 bits, starting from the least-significant. */ #define stdc_trailing_zeros_ui(__x) stdc_trailing_zeros((unsignedint) (__x)) /** Returns the count of consecutive 0 bits, starting from the least-significant. */ #define stdc_trailing_zeros_ul(__x) stdc_trailing_zeros((unsignedlong) (__x)) /** Returns the count of consecutive 0 bits, starting from the least-significant. */ #define stdc_trailing_zeros_ull(__x) stdc_trailing_zeros((unsignedlonglong) (__x)) /** Returns the count of consecutive 0 bits, starting from the least-significant. */ #define stdc_trailing_zeros(__x) \
((unsignedint) __builtin_ctzg(__x, \
(int) (8 * sizeof(__x))))
/* C23 7.18.6 Count Trailing Ones */
/** Returns the count of consecutive 1 bits, starting from the least-significant. */ #define stdc_trailing_ones_uc(__x) stdc_trailing_ones((unsignedchar) (__x)) /** Returns the count of consecutive 1 bits, starting from the least-significant. */ #define stdc_trailing_ones_us(__x) stdc_trailing_ones((unsignedshort) (__x)) /** Returns the count of consecutive 1 bits, starting from the least-significant. */ #define stdc_trailing_ones_ui(__x) stdc_trailing_ones((unsignedint) (__x)) /** Returns the count of consecutive 1 bits, starting from the least-significant. */ #define stdc_trailing_ones_ul(__x) stdc_trailing_ones((unsignedlong) (__x)) /** Returns the count of consecutive 1 bits, starting from the least-significant. */ #define stdc_trailing_ones_ull(__x) stdc_trailing_ones((unsignedlonglong) (__x)) /** Returns the count of consecutive 1 bits, starting from the least-significant. */ #define stdc_trailing_ones(__x) \
((unsignedint) (__builtin_ctzg((typeof(__x)) ~(__x), \
(int) (8 * sizeof(__x)))))
/* C23 7.18.7 First Leading Zero */
/** Returns the index of the first 0 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_zero_uc(__x) stdc_first_leading_zero((unsignedchar) (__x)) /** Returns the index of the first 0 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_zero_us(__x) stdc_first_leading_zero((unsignedshort) (__x)) /** Returns the index of the first 0 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_zero_ui(__x) stdc_first_leading_zero((unsignedint) (__x)) /** Returns the index of the first 0 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_zero_ul(__x) stdc_first_leading_zero((unsignedlong) (__x)) /** Returns the index of the first 0 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_zero_ull(__x) stdc_first_leading_zero((unsignedlonglong) (__x)) /** Returns the index of the first 0 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_zero(__x) ({ \
typeof(__x) __val = (__x); \
((unsignedint) ((__val == (typeof(__x)) -1 \
? 0 \
: 1 + __builtin_clzg((typeof(__x)) ~__val)))); \
})
/* C23 7.18.8 First Leading One */
/** Returns the index of the first 1 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_one_uc(__x) stdc_first_leading_one((unsignedchar) (__x)) /** Returns the index of the first 1 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_one_us(__x) stdc_first_leading_one((unsignedshort) (__x)) /** Returns the index of the first 1 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_one_ui(__x) stdc_first_leading_one((unsignedint) (__x)) /** Returns the index of the first 1 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_one_ul(__x) stdc_first_leading_one((unsignedlong) (__x)) /** Returns the index of the first 1 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_one_ull(__x) stdc_first_leading_one((unsignedlonglong) (__x)) /** Returns the index of the first 1 bit, plus 1, starting from the most-significant (0 if none). */ #define stdc_first_leading_one(__x) ({ \
typeof(__x) __val = (__x); \
((unsignedint) ((__val == (typeof(__val)) 0 \
? 0 \
: 1 + __builtin_clzg(__val)))); \
})
/* C23 7.18.9 First Trailing Zero */ /** Returns the index of the first 0 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_zero_uc(__x) stdc_first_trailing_zero((unsignedchar) (__x)) /** Returns the index of the first 0 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_zero_us(__x) stdc_first_trailing_zero((unsignedshort) (__x)) /** Returns the index of the first 0 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_zero_ui(__x) stdc_first_trailing_zero((unsignedint) (__x)) /** Returns the index of the first 0 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_zero_ul(__x) stdc_first_trailing_zero((unsignedlong) (__x)) /** Returns the index of the first 0 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_zero_ull(__x) stdc_first_trailing_zero((unsignedlonglong) (__x)) /** Returns the index of the first 0 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_zero(__x) ({ \
typeof(__x) __val = (__x); \
((unsignedint) ((__val == (typeof(__val)) -1 \
? 0 \
: 1 + __builtin_ctzg((typeof(__val)) ~__val)))); \
})
/* C23 7.18.10 First Trailing One */ /** Returns the index of the first 1 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_one_uc(__x) stdc_first_trailing_one((unsignedchar) (__x)) /** Returns the index of the first 1 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_one_us(__x) stdc_first_trailing_one((unsignedshort) (__x)) /** Returns the index of the first 1 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_one_ui(__x) stdc_first_trailing_one((unsignedint) (__x)) /** Returns the index of the first 1 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_one_ul(__x) stdc_first_trailing_one((unsignedlong) (__x)) /** Returns the index of the first 1 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_one_ull(__x) stdc_first_trailing_one((unsignedlonglong) (__x)) /** Returns the index of the first 1 bit, plus 1, starting from the least-significant (0 if none). */ #define stdc_first_trailing_one(__x) \
((unsignedint) (((__x) == (typeof(__x)) 0 \
? 0 \
: 1 + __builtin_ctzg(__x))))
/* C23 7.18.11 Count Zeros */
/** Returns the count of 0 bits. */ #define stdc_count_zeros_uc(__x) stdc_count_zeros((unsignedchar) (__x)) /** Returns the count of 0 bits. */ #define stdc_count_zeros_us(__x) stdc_count_zeros((unsignedshort) (__x)) /** Returns the count of 0 bits. */ #define stdc_count_zeros_ui(__x) stdc_count_zeros((unsignedint) (__x)) /** Returns the count of 0 bits. */ #define stdc_count_zeros_ul(__x) stdc_count_zeros((unsignedlong) (__x)) /** Returns the count of 0 bits. */ #define stdc_count_zeros_ull(__x) stdc_count_zeros((unsignedlonglong) (__x)) /** Returns the count of 0 bits. */ #define stdc_count_zeros(__x) ((unsignedint) ((8 * sizeof(__x)) - __builtin_popcountg(__x)))
/* C23 7.18.12 Count Ones */
/** Returns the count of 1 bits. */ #define stdc_count_ones_uc(__x) stdc_count_ones((unsignedchar) (__x)) /** Returns the count of 1 bits. */ #define stdc_count_ones_us(__x) stdc_count_ones((unsignedshort) (__x)) /** Returns the count of 1 bits. */ #define stdc_count_ones_ui(__x) stdc_count_ones((unsignedint) (__x)) /** Returns the count of 1 bits. */ #define stdc_count_ones_ul(__x) stdc_count_ones((unsignedlong) (__x)) /** Returns the count of 1 bits. */ #define stdc_count_ones_ull(__x) stdc_count_ones((unsignedlonglong) (__x)) /** Returns the count of 1 bits. */ #define stdc_count_ones(__x) ((unsignedint) __builtin_popcountg(__x))
/* C23 7.18.13 Single-Bit Check */ /** Returns true if exactly one bit is set (that is: it's a non-zero power of 2). */ #define stdc_has_single_bit_uc(__x) stdc_has_single_bit((unsignedchar) (__x)) /** Returns true if exactly one bit is set (that is: it's a non-zero power of 2). */ #define stdc_has_single_bit_us(__x) stdc_has_single_bit((unsignedshort) (__x)) /** Returns true if exactly one bit is set (that is: it's a non-zero power of 2). */ #define stdc_has_single_bit_ui(__x) stdc_has_single_bit((unsignedint) (__x)) /** Returns true if exactly one bit is set (that is: it's a non-zero power of 2). */ #define stdc_has_single_bit_ul(__x) stdc_has_single_bit((unsignedlong) (__x)) /** Returns true if exactly one bit is set (that is: it's a non-zero power of 2). */ #define stdc_has_single_bit_ull(__x) stdc_has_single_bit((unsignedlonglong) (__x)) /** Returns true if exactly one bit is set (that is: it's a non-zero power of 2). */ #define stdc_has_single_bit(__x) ({ \
typeof(__x) __val = (__x); \
((bool) (__val != 0 && ((__val & (__val - 1)) == 0))); \
})
/* C23 7.18.14 Bit Width */ /** Returns the smallest number of bits needed to store the value (0 for 0). */ #define stdc_bit_width_uc(__x) stdc_bit_width((unsignedchar) (__x)) /** Returns the smallest number of bits needed to store the value (0 for 0). */ #define stdc_bit_width_us(__x) stdc_bit_width((unsignedshort) (__x)) /** Returns the smallest number of bits needed to store the value (0 for 0). */ #define stdc_bit_width_ui(__x) stdc_bit_width((unsignedint) (__x)) /** Returns the smallest number of bits needed to store the value (0 for 0). */ #define stdc_bit_width_ul(__x) stdc_bit_width((unsignedlong) (__x)) /** Returns the smallest number of bits needed to store the value (0 for 0). */ #define stdc_bit_width_ull(__x) stdc_bit_width((unsignedlonglong) (__x)) /** Returns the smallest number of bits needed to store the value (0 for 0). */ #define stdc_bit_width(__x) \
((unsignedint) (8 * sizeof(__x)) - __builtin_clzg(__x, \
(int) (8 * sizeof(__x))))
/* C23 7.18.15 Bit Floor */ /** Returns the largest integral power of 2 not greater than the value (0 for 0). */ #define stdc_bit_floor_uc(__x) stdc_bit_floor((unsignedchar) (__x)) /** Returns the largest integral power of 2 not greater than the value (0 for 0). */ #define stdc_bit_floor_us(__x) stdc_bit_floor((unsignedshort) (__x)) /** Returns the largest integral power of 2 not greater than the value (0 for 0). */ #define stdc_bit_floor_ui(__x) stdc_bit_floor((unsignedint) (__x)) /** Returns the largest integral power of 2 not greater than the value (0 for 0). */ #define stdc_bit_floor_ul(__x) stdc_bit_floor((unsignedlong) (__x)) /** Returns the largest integral power of 2 not greater than the value (0 for 0). */ #define stdc_bit_floor_ull(__x) stdc_bit_floor((unsignedlonglong) (__x)) /** Returns the largest integral power of 2 not greater than the value (0 for 0). */ #define stdc_bit_floor(__x) ({ \
typeof(__x) __val = (__x); \
((typeof(__val)) (__val == 0 ? 0 : ((typeof(__val)) 1) << (stdc_bit_width(__val) - 1))); \
})
/* C23 7.18.15 Bit Ceil */ /** Returns the smallest integral power of 2 not less than the value. */ #define stdc_bit_ceil_uc(__x) stdc_bit_ceil((unsignedchar) (__x)) /** Returns the smallest integral power of 2 not less than the value. */ #define stdc_bit_ceil_us(__x) stdc_bit_ceil((unsignedshort) (__x)) /** Returns the smallest integral power of 2 not less than the value. */ #define stdc_bit_ceil_ui(__x) stdc_bit_ceil((unsignedint) (__x)) /** Returns the smallest integral power of 2 not less than the value. */ #define stdc_bit_ceil_ul(__x) stdc_bit_ceil((unsignedlong) (__x)) /** Returns the smallest integral power of 2 not less than the value. */ #define stdc_bit_ceil_ull(__x) stdc_bit_ceil((unsignedlonglong) (__x)) /** Returns the smallest integral power of 2 not less than the value. */ #define stdc_bit_ceil(__x) ({ \
typeof(__x) __result = 1; \
typeof(__x) __val = (__x); \ if (__val > 1) { \ /* Avoid shifts greater than the width of the type. */ \ unsigned __shift = stdc_bit_width(__val - 1u); \ if (__shift < 8 * sizeof(__result)) __result = 1ull << __shift; \ else __result = 0; \
} \
__result; })
__END_DECLS
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-06-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.