VirtualBox

source: vbox/trunk/include/iprt/nocrt/x86/math.h@ 7176

Last change on this file since 7176 was 5999, checked in by vboxsync, 17 years ago

The Giant CDDL Dual-License Header Change.

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
1/** @file
2 * innotek Portable Runtime / No-CRT - math.h, x86 inlined functions.
3 */
4
5/*
6 * Copyright (C) 2006-2007 innotek GmbH
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___iprt_nocrt_x86_math_h
27#define ___iprt_nocrt_x86_math_h
28
29#include <iprt/asm.h>
30
31#if RT_INLINE_ASM_GNU_STYLE
32
33DECLINLINE(long double) inline_atan2l(long double lrd1, long double lrd2)
34{
35 long double lrdResult;
36 __asm__ __volatile__("fpatan"
37 : "=t" (lrdResult)
38 : "u" (lrd1),
39 "0" (lrd2)
40 : "st(1)");
41 return lrdResult;
42}
43
44DECLINLINE(long double) inline_rintl(long double lrd)
45{
46 long double lrdResult;
47 __asm__ __volatile__("frndint"
48 : "=t" (lrdResult)
49 : "0" (lrd));
50 return lrdResult;
51}
52
53DECLINLINE(float) inline_rintf(float rf)
54{
55 return (float)inline_rintl(rf);
56}
57
58DECLINLINE(double) inline_rint(double rd)
59{
60 return (double)inline_rintl(rd);
61}
62
63DECLINLINE(long double) inline_sqrtl(long double lrd)
64{
65 long double lrdResult;
66 __asm__ __volatile__("fsqrt"
67 : "=t" (lrdResult)
68 : "0" (lrd));
69 return lrdResult;
70}
71
72DECLINLINE(float) inline_sqrtf(float rf)
73{
74 return (float)inline_sqrtl(rf);
75}
76
77DECLINLINE(double) inline_sqrt(double rd)
78{
79 return (double)inline_sqrt(rd);
80}
81
82
83# undef atan2l
84# define atan2l(lrd1, lrd2) inline_atan2l(lrd1, lrd2)
85# undef rint
86# define rint(rd) inline_rint(rd)
87# undef rintf
88# define rintf(rf) inline_rintf(rf)
89# undef rintl
90# define rintl(lrd) inline_rintl(lrd)
91# undef sqrt
92# define sqrt(rd) inline_sqrt(rd)
93# undef sqrtf
94# define sqrtf(rf) inline_sqrtf(rf)
95# undef sqrtl
96# define sqrtl(lrd) inline_sqrtl(lrd)
97
98#endif /* RT_INLINE_ASM_GNU_STYLE */
99
100#endif
101
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette