OpenCL has a builtin function clz() to count the number of leading zeros of a long, int, etc. but nothing similar seems to be present for counting the number of trailing zeros. I’ve not been able to find any way to do this, other than just manually re-implementing of course. What is the proper way to do this?
OpenCL has a builtin function clz() to count the number of leading zeros of
Share
leaves one least significant 1-bit. To get its position you can try something like: