VirtualBox

source: vbox/trunk/include/iprt/nocrt/amd64/math.h@ 8155

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

The Big Sun Rebranding Header Change

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1/** @file
2 * innotek Portable Runtime / No-CRT - math.h, AMD inlined functions.
3 */
4
5/*
6 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
26 * Clara, CA 95054 USA or visit http://www.sun.com if you need
27 * additional information or have any questions.
28 */
29
30#ifndef ___iprt_nocrt_amd64_math_h
31#define ___iprt_nocrt_amd64_math_h
32
33#include <iprt/asm.h>
34
35
36#if RT_INLINE_ASM_GNU_STYLE
37
38DECLINLINE(long double) inline_atan2l(long double lrd1, long double lrd2)
39{
40 long double lrdResult;
41 __asm__ __volatile__("fpatan"
42 : "=t" (lrdResult)
43 : "u" (lrd1),
44 "0" (lrd2)
45 : "st(1)");
46 return lrdResult;
47}
48
49DECLINLINE(long double) inline_rintl(long double lrd)
50{
51 long double lrdResult;
52 __asm__ __volatile__("frndint"
53 : "=t" (lrdResult)
54 : "0" (lrd));
55 return lrdResult;
56}
57
58DECLINLINE(float) inline_rintf(float rf)
59{
60 return (float)inline_rintl(rf);
61}
62
63DECLINLINE(double) inline_rint(double rd)
64{
65 return (double)inline_rintl(rd);
66}
67
68DECLINLINE(long double) inline_sqrtl(long double lrd)
69{
70 long double lrdResult;
71 __asm__ __volatile__("fsqrt"
72 : "=t" (lrdResult)
73 : "0" (lrd));
74 return lrdResult;
75}
76
77DECLINLINE(float) inline_sqrtf(float rf)
78{
79 return (float)inline_sqrtl(rf);
80}
81
82DECLINLINE(double) inline_sqrt(double rd)
83{
84 return (double)inline_sqrt(rd);
85}
86
87
88# undef atan2l
89# define atan2l(lrd1, lrd2) inline_atan2l(lrd1, lrd2)
90# undef rint
91# define rint(rd) inline_rint(rd)
92# undef rintf
93# define rintf(rf) inline_rintf(rf)
94# undef rintl
95# define rintl(lrd) inline_rintl(lrd)
96# undef sqrt
97# define sqrt(rd) inline_sqrt(rd)
98# undef sqrtf
99# define sqrtf(rf) inline_sqrtf(rf)
100# undef sqrtl
101# define sqrtl(lrd) inline_sqrtl(lrd)
102
103#endif /* RT_INLINE_ASM_GNU_STYLE */
104
105#endif
106
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