shithub: femtolisp

ref: c2cff341a39d3182820a0fc1f5462207cf78a6c2
dir: /builtins_plan9.c/

View raw version
#include "platform.h"

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