Fixed undefined behaviour with ctz and clz.