Hello,

the following question came up for a libstdc++ patch. We have a variable of type uintmax_t and want to count the leading zeros. Can we just call __builtin_clzll on it?

In particular, can uintmax_t be larger than unsigned long long in gcc? Is __builtin_clzll available on all platforms? Is there a good reason to use __builtin_clzl instead on platforms where long and long long have the same size?

In case it matters, this is strictly for compile-time computations (templates, constexpr).

--
Marc Glisse

Reply via email to