Similar to this issue taichi-dev/taichi#8212
We are implementing a data structure for simulation and encountered the same problem as described in this issue. Could you please take a look and see if we can simply add that? Thank you!
In taichi, the implementation is quite brute force
def clz(a):
"""Count the number of leading zeros for a 32bit integer"""
def _clz(x):
for i in range(32):
if 2**i > x:
return 32 - i
return 0
return _unary_operation(_ti_core.expr_clz, _clz, a)