I’m looking for an efficient calculation of counting the leading-zero-bits in an unsigned integer. I found std.zig.c_builtins.__builtin_clz but that’s only for c_uint. Right now I’d like to do it on a u64. Does this exist? If not, is there a known idiom that the optimizer will collapse to efficient code (e.g. LZCNT on amd64)? FWIW, gcc and clang have a __builtin_clzl, which would do the trick, but this doesn’t appear to be exposed in std.zig on 0.14

`@clz`

## Filler

Filler to satisfy minimum post size

1 Like

Gah, I was searching std and didn’t even think of searching the builtins. Thanks!

1 Like

It can take a while to develop an intuition for what’s a builtin vs. what you’ll find in std. We had a good thread about that not so long ago.