Salut Marc ! > We have a variable of type uintmax_t and want to count the leading zeros. Can > we just call __builtin_clzll on it?
Yes. > In particular, can uintmax_t be larger than unsigned long long in gcc? uintmax_t is the largest of the standard unsigned C types, so it cannot be larger than unsigned long long. On x86_64, for example: > #include <stdio.h> > #include <stdint.h> > > int main (void) > { > printf ("%lu ", sizeof (uintmax_t)); > printf ("%lu ", sizeof (int)); > printf ("%lu ", sizeof (long int)); > printf ("%lu ", sizeof (long long int)); > printf ("%lu\n", sizeof (__int128)); > } gives : 8 4 8 8 16 > Is __builtin_clzll available on all platforms? Yes, we emit calls to this built-in unconditionally in the Fortran front-end, and it has caused no trouble. FX