shithub: sl

ref: bbfee60f6716dce8cf7a802c044cf7d0fe8bb6f2
dir: /src/plan9/clz.c/

View raw version
#include "platform.h"

int
sl_clz(u32int x)
{
	u32int r;
	if(x == 0)
		return 32;
	for(r = 0; (x & (1UL<<31)) == 0; x <<= 1, r++);
	return r;
}