VirtualBox

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

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

Biggest check-in ever. New source code headers for all (C) innotek files.

File size: 2.4 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 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
17#ifndef ___iprt_nocrt_x86_math_h
18#define ___iprt_nocrt_x86_math_h
19
20#include <iprt/asm.h>
21
22#if RT_INLINE_ASM_GNU_STYLE
23
24DECLINLINE(long double) inline_atan2l(long double lrd1, long double lrd2)
25{
26 long double lrdResult;
27 __asm__ __volatile__("fpatan"
28 : "=t" (lrdResult)
29 : "u" (lrd1),
30 "0" (lrd2)
31 : "st(1)");
32 return lrdResult;
33}
34
35DECLINLINE(long double) inline_rintl(long double lrd)
36{
37 long double lrdResult;
38 __asm__ __volatile__("frndint"
39 : "=t" (lrdResult)
40 : "0" (lrd));
41 return lrdResult;
42}
43
44DECLINLINE(float) inline_rintf(float rf)
45{
46 return (float)inline_rintl(rf);
47}
48
49DECLINLINE(double) inline_rint(double rd)
50{
51 return (double)inline_rintl(rd);
52}
53
54DECLINLINE(long double) inline_sqrtl(long double lrd)
55{
56 long double lrdResult;
57 __asm__ __volatile__("fsqrt"
58 : "=t" (lrdResult)
59 : "0" (lrd));
60 return lrdResult;
61}
62
63DECLINLINE(float) inline_sqrtf(float rf)
64{
65 return (float)inline_sqrtl(rf);
66}
67
68DECLINLINE(double) inline_sqrt(double rd)
69{
70 return (double)inline_sqrt(rd);
71}
72
73
74# undef atan2l
75# define atan2l(lrd1, lrd2) inline_atan2l(lrd1, lrd2)
76# undef rint
77# define rint(rd) inline_rint(rd)
78# undef rintf
79# define rintf(rf) inline_rintf(rf)
80# undef rintl
81# define rintl(lrd) inline_rintl(lrd)
82# undef sqrt
83# define sqrt(rd) inline_sqrt(rd)
84# undef sqrtf
85# define sqrtf(rf) inline_sqrtf(rf)
86# undef sqrtl
87# define sqrtl(lrd) inline_sqrtl(lrd)
88
89#endif /* RT_INLINE_ASM_GNU_STYLE */
90
91#endif
92
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