One thing that I would like to do is to compile-time assert that the log2 of an alignment is less a given size. A simple way to do log2 of a power of 2 is to use trailing_zeros. But trailing_zeros is not const, so it's not possible to do a compile-time check.
The equivalent __builtins in clang are const (example: https://godbolt.org/g/RxWczn) so llvm should be able to handle that.
However, adding const to the functions in core::num requires adding const to the corresponding intrinsics, and that is not supported (extern items cannot be 'const')
One thing that I would like to do is to compile-time assert that the log2 of an alignment is less a given size. A simple way to do log2 of a power of 2 is to use
trailing_zeros. Buttrailing_zerosis not const, so it's not possible to do a compile-time check.The equivalent
__builtins in clang are const (example: https://godbolt.org/g/RxWczn) so llvm should be able to handle that.However, adding
constto the functions incore::numrequires addingconstto the corresponding intrinsics, and that is not supported (extern items cannot be 'const')