ReactOS 0.4.15-dev-7906-g1b85a5f
_control87.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS CRT
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Implementation of _control87
5 * COPYRIGHT: Copyright 2022 Timo Kreuzer <timo.kreuzer@reactos.org>
6 */
7
8#include <xmmintrin.h>
9#include <float.h>
10
11unsigned int _get_native_fpcw(void);
12void _set_native_fpcw(unsigned int value);
13unsigned int _fpcw_native_to_abstract(unsigned int native);
14unsigned int _fpcw_abstract_to_native(unsigned int abstract);
15
16unsigned int __cdecl _control87(unsigned int newval, unsigned int mask)
17{
18 unsigned int native, oldval, updated;
19
20 /* Sanatize the mask */
22
23 /* Get native control word */
24 native = _get_native_fpcw();
25
26 /* Convert to abstract */
27 oldval = _fpcw_native_to_abstract(native);
28
29 /* Update it according to the given parameters */
30 updated = (oldval & ~mask) | (newval & mask);
31
32 /* Convert back to native */
33 native = _fpcw_abstract_to_native(updated);
34
35 /* Set the native value */
36 _set_native_fpcw(native);
37
38 return updated;
39}
unsigned int _fpcw_native_to_abstract(unsigned int native)
Definition: machfpcw.c:23
void _set_native_fpcw(unsigned int value)
Definition: machfpcw.c:18
unsigned int _fpcw_abstract_to_native(unsigned int abstract)
Definition: machfpcw.c:69
unsigned int __cdecl _control87(unsigned int newval, unsigned int mask)
Definition: _control87.c:16
unsigned int _get_native_fpcw(void)
Definition: machfpcw.c:13
#define __cdecl
Definition: accygwin.h:79
GLenum GLint GLuint mask
Definition: glext.h:6028
#define _MCW_EM
Definition: float.h:40
#define _MCW_RC
Definition: float.h:42
#define _MCW_DN
Definition: float.h:44
char * abstract
Definition: pdh_main.c:94