shithub: snippets

ref: 6c5f25a2fd0da669d735d457d0e7c04d2dc2efcc
dir: /lrint.c/

View raw version
int
lrintf(float f)
{
	int i;

	*((float*)&i) = f + 12582912.0f;

	return (i & 0x7fffff) - 0x400000;
}

long
lrint(double d)
{
	long long l;

	*((double*)&l) = d + 6755399441055744.0;

	return l;
}