Or, you can consider using ISO C (C23), which should be "usable" within C++.
There's <stdbit.h> and the stdc_leading_zeros{c,s,i,l,ll}(3) family of
functions, and the stdc_leading_zeros(3) type-generic function (which might be
unavailable in C++, or maybe they implement it as an overloaded function, or
maybe an 'auto' macro; we'll see).
Extended integer types, least-width integer types, and exact-width integer types, can all be used with the type-generic macros since the type-generic macros are required to work over all standard (unsigned) integer types and extended (unsigned) integer types, while excluding bool and bit-precise (_BitInt(N)) integer types that do not match pre-existing type widths.