VirtualBox

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

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

iprt_hdr_h -> _iprt_hdr_h

File size: 2.6 KB
Line 
1/** @file
2 * innotek Portable Runtime / No-CRT - math.h, AMD 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 as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * If you received this file as part of a commercial VirtualBox
17 * distribution, then only the terms of your commercial VirtualBox
18 * license agreement apply instead of the previous paragraph.
19 */
20
21#ifndef ___iprt_nocrt_amd64_math_h
22#define ___iprt_nocrt_amd64_math_h
23
24#include <iprt/asm.h>
25
26
27#if RT_INLINE_ASM_GNU_STYLE
28
29DECLINLINE(long double) inline_atan2l(long double lrd1, long double lrd2)
30{
31 long double lrdResult;
32 __asm__ __volatile__("fpatan"
33 : "=t" (lrdResult)
34 : "u" (lrd1),
35 "0" (lrd2)
36 : "st(1)");
37 return lrdResult;
38}
39
40DECLINLINE(long double) inline_rintl(long double lrd)
41{
42 long double lrdResult;
43 __asm__ __volatile__("frndint"
44 : "=t" (lrdResult)
45 : "0" (lrd));
46 return lrdResult;
47}
48
49DECLINLINE(float) inline_rintf(float rf)
50{
51 return (float)inline_rintl(rf);
52}
53
54DECLINLINE(double) inline_rint(double rd)
55{
56 return (double)inline_rintl(rd);
57}
58
59DECLINLINE(long double) inline_sqrtl(long double lrd)
60{
61 long double lrdResult;
62 __asm__ __volatile__("fsqrt"
63 : "=t" (lrdResult)
64 : "0" (lrd));
65 return lrdResult;
66}
67
68DECLINLINE(float) inline_sqrtf(float rf)
69{
70 return (float)inline_sqrtl(rf);
71}
72
73DECLINLINE(double) inline_sqrt(double rd)
74{
75 return (double)inline_sqrt(rd);
76}
77
78
79# undef atan2l
80# define atan2l(lrd1, lrd2) inline_atan2l(lrd1, lrd2)
81# undef rint
82# define rint(rd) inline_rint(rd)
83# undef rintf
84# define rintf(rf) inline_rintf(rf)
85# undef rintl
86# define rintl(lrd) inline_rintl(lrd)
87# undef sqrt
88# define sqrt(rd) inline_sqrt(rd)
89# undef sqrtf
90# define sqrtf(rf) inline_sqrtf(rf)
91# undef sqrtl
92# define sqrtl(lrd) inline_sqrtl(lrd)
93
94#endif /* RT_INLINE_ASM_GNU_STYLE */
95
96#endif
97
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