Added binary and unicode file i/o support to msvcrt.
[reactos.git] / reactos / lib / msvcrt / float / cntrlfp.c
1 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
2
3 #include <msvcrt/float.h>
4
5 unsigned int _controlfp(unsigned int unNew, unsigned int unMask)
6 {
7 return _control87(unNew,unMask);
8 }
9
10 unsigned int _control87(unsigned int unNew, unsigned int unMask)
11 {
12 register unsigned int __res;
13 #ifdef __GNUC__
14 __asm__ __volatile__ (
15 "pushl %%eax \n\t" /* make room on stack */
16 "fstcw (%%esp) \n\t"
17 "fwait \n\t"
18 "popl %%eax \n\t"
19 "andl $0xffff, %%eax \n\t" /* OK; we have the old value ready */
20
21 "movl %1, %%ecx \n\t"
22 "notl %%ecx \n\t"
23 "andl %%eax, %%ecx \n\t" /* the bits we want to keep */
24
25 "movl %2, %%edx \n\t"
26 "andl %1, %%edx \n\t" /* the bits we want to change */
27
28 "orl %%ecx, %%edx\n\t" /* the new value */
29 "pushl %%edx \n\t"
30 "fldcw (%%esp) \n\t"
31 "popl %%edx \n\t"
32
33 :"=r" (__res):"r" (unNew),"r" (unMask): "ax", "dx", "cx");
34 #else
35 #endif /*__GNUC__*/
36 return __res;
37 }