2011-12-22 15:19:25 +00:00
|
|
|
/*
|
|
|
|
* \brief Simple math calls
|
|
|
|
* \author Julian Stecklina
|
|
|
|
* \date 2008-02-20
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2012-01-03 14:35:05 +00:00
|
|
|
* Copyright (C) 2008-2012 Genode Labs GmbH
|
2011-12-22 15:19:25 +00:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace SMath {
|
|
|
|
|
|
|
|
static inline float sinf(float x)
|
|
|
|
{
|
|
|
|
float res;
|
|
|
|
|
|
|
|
asm ("fsin"
|
|
|
|
: "=t" (res) /* output */
|
|
|
|
: "0" (x) /* input */
|
|
|
|
: /* clobbers */
|
|
|
|
);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline float cosf(float x)
|
|
|
|
{
|
|
|
|
float res;
|
|
|
|
|
|
|
|
asm ("fcos"
|
|
|
|
: "=t" (res) /* output */
|
|
|
|
: "0" (x) /* input */
|
|
|
|
: /* clobbers */
|
|
|
|
);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline float sqrtf(float x)
|
|
|
|
{
|
|
|
|
float res;
|
|
|
|
|
|
|
|
asm ("fsqrt"
|
|
|
|
: "=t" (res) /* output */
|
|
|
|
: "0" (x) /* input */
|
|
|
|
: /* clobbers */
|
|
|
|
);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|