shithub: femtolisp

ref: d60399e18345e69419489f201f27f19f1a5616b2
dir: /plan9_builtins.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;
}