user32/tests: Fix some test failures on Win9x.
[wine/multimedia.git] / dlls / ntdll / misc.c
blob218c2897bd31c86b9c688e0c8ef240955832e0e5
1 /*
2 * Helper functions for ntdll
4 * Copyright 2000 Juergen Schmied
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <time.h>
24 #include <math.h>
26 #include "wine/library.h"
27 #include "wine/debug.h"
28 #include "ntdll_misc.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
32 #if defined(__GNUC__) && defined(__i386__)
33 #define DO_FPU(x,y) __asm__ __volatile__( x " %0;fwait" : "=m" (y) : )
34 #define POP_FPU(x) DO_FPU("fstpl",x)
35 #endif
37 void dump_ObjectAttributes (const OBJECT_ATTRIBUTES *oa)
39 if (oa)
40 TRACE("%p:(name=%s, attr=0x%08x, hRoot=%p, sd=%p)\n",
41 oa, debugstr_us(oa->ObjectName),
42 oa->Attributes, oa->RootDirectory, oa->SecurityDescriptor);
45 LPCSTR debugstr_us( const UNICODE_STRING *us )
47 if (!us) return "<null>";
48 return debugstr_wn(us->Buffer, us->Length / sizeof(WCHAR));
51 /*********************************************************************
52 * _ftol (NTDLL.@)
54 * VERSION
55 * [GNUC && i386]
57 #if defined(__GNUC__) && defined(__i386__)
58 LONGLONG CDECL NTDLL__ftol(void)
60 /* don't just do DO_FPU("fistp",retval), because the rounding
61 * mode must also be set to "round towards zero"... */
62 double fl;
63 POP_FPU(fl);
64 return (LONGLONG)fl;
66 #endif /* defined(__GNUC__) && defined(__i386__) */
68 /*********************************************************************
69 * _ftol (NTDLL.@)
71 * FIXME
72 * Should be register function
73 * VERSION
74 * [!GNUC && i386]
76 #if !defined(__GNUC__) && defined(__i386__)
77 LONGLONG CDECL NTDLL__ftol(double fl)
79 FIXME("should be register function\n");
80 return (LONGLONG)fl;
82 #endif /* !defined(__GNUC__) && defined(__i386__) */
84 /*********************************************************************
85 * _ftol (NTDLL.@)
86 * VERSION
87 * [!i386]
89 #ifndef __i386__
90 LONG CDECL NTDLL__ftol(double fl)
92 return (LONG) fl;
94 #endif /* !defined(__i386__) */
96 /*********************************************************************
97 * _CIpow (NTDLL.@)
98 * VERSION
99 * [GNUC && i386]
101 #if defined(__GNUC__) && defined(__i386__)
102 double CDECL NTDLL__CIpow(void)
104 double x,y;
105 POP_FPU(y);
106 POP_FPU(x);
107 return pow(x,y);
109 #endif /* defined(__GNUC__) && defined(__i386__) */
112 /*********************************************************************
113 * _CIpow (NTDLL.@)
115 * FIXME
116 * Should be register function
118 * VERSION
119 * [!GNUC && i386]
121 #if !defined(__GNUC__) && defined(__i386__)
122 double CDECL NTDLL__CIpow(double x,double y)
124 FIXME("should be register function\n");
125 return pow(x,y);
127 #endif /* !defined(__GNUC__) && defined(__i386__) */
129 /*********************************************************************
130 * _CIpow (NTDLL.@)
131 * VERSION
132 * [!i386]
134 #ifndef __i386__
135 double CDECL NTDLL__CIpow(double x,double y)
137 return pow(x,y);
139 #endif /* !defined(__i386__) */
142 /*********************************************************************
143 * wine_get_version (NTDLL.@)
145 const char * CDECL NTDLL_wine_get_version(void)
147 return wine_get_version();
150 /*********************************************************************
151 * wine_get_build_id (NTDLL.@)
153 const char * CDECL NTDLL_wine_get_build_id(void)
155 return wine_get_build_id();
158 /*********************************************************************
159 * abs (NTDLL.@)
161 int CDECL NTDLL_abs( int i )
163 return abs( i );
166 /*********************************************************************
167 * labs (NTDLL.@)
169 LONG CDECL NTDLL_labs( LONG i )
171 return labs( i );
174 /*********************************************************************
175 * atan (NTDLL.@)
177 double CDECL NTDLL_atan( double d )
179 return atan( d );
182 /*********************************************************************
183 * ceil (NTDLL.@)
185 double CDECL NTDLL_ceil( double d )
187 return ceil( d );
190 /*********************************************************************
191 * cos (NTDLL.@)
193 double CDECL NTDLL_cos( double d )
195 return cos( d );
198 /*********************************************************************
199 * fabs (NTDLL.@)
201 double CDECL NTDLL_fabs( double d )
203 return fabs( d );
206 /*********************************************************************
207 * floor (NTDLL.@)
209 double CDECL NTDLL_floor( double d )
211 return floor( d );
214 /*********************************************************************
215 * log (NTDLL.@)
217 double CDECL NTDLL_log( double d )
219 return log( d );
222 /*********************************************************************
223 * pow (NTDLL.@)
225 double CDECL NTDLL_pow( double x, double y )
227 return pow( x, y );
230 /*********************************************************************
231 * sin (NTDLL.@)
233 double CDECL NTDLL_sin( double d )
235 return sin( d );
238 /*********************************************************************
239 * sqrt (NTDLL.@)
241 double CDECL NTDLL_sqrt( double d )
243 return sqrt( d );
246 /*********************************************************************
247 * tan (NTDLL.@)
249 double CDECL NTDLL_tan( double d )
251 return tan( d );