Bit instructions from C++. Do we have them?

From a Twitter post:

Do we have all these? Seems like we do have some of them. Could be good practice to adopt the missing ones.

The source is: C23 stdbit.h quick reference

leading_zeros
# no replacement that I know of
trailing_zeros
# no replacement that I know of
count_ones
# count_ones(x)==1
Base.top_set_bit
prevpow(2,x)
nextpow(2,x)
leading_ones
# no replacement that I know of
trailing_ones
# no replacement that I know of
count_zeros
4 Likes