genode/base-pistachio/include/x86/util/smath.h
2012-01-03 15:35:05 +01:00

55 lines
868 B
C++

/*
* \brief Simple math calls
* \author Julian Stecklina
* \date 2008-02-20
*/
/*
* 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.
*/
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;
}
}