genode/libports/src/lib/libc/log2.c
Christian Prochaska 2d290c0898 Preliminary 'log2()' and 'log2f()' implementation
The 'log2()' and 'log2f()' functions have been added in FreeBSD's libc
version 9.0.0, but they are missing in version 8.2.0, which is used in
Genode. This patch provides preliminary implementations of these
functions until the Genode libc gets updated to version 9.0.0 or above.

Fixes #143.
2012-03-08 10:42:21 +01:00

27 lines
437 B
C

/*
* \brief Preliminary 'log2()' and 'log2f()' implementations
* \author Christian Prochaska
* \date 2012-03-06
*/
/*
* Copyright (C) 2008-2012 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#include <math.h>
double log2(double x)
{
return log(x) / log(2);
}
float log2f(float x)
{
return logf(x) / logf(2);
}