ctlz and cttz implementation