master
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6
7#include <fenv.h>
8#include <internal.h>
9
10/* 7.6.2.2
11 The fegetexceptflag function stores an implementation-defined
12 representation of the exception flags indicated by the argument
13 excepts in the object pointed to by the argument flagp. */
14
15int fegetexceptflag(fexcept_t *status, int excepts)
16{
17#if defined(__i386__) || (defined(__x86_64__) && !defined(__arm64ec__))
18 unsigned int x87, sse;
19 __mingw_setfp(NULL, 0, &x87, 0);
20 __mingw_setfp_sse(NULL, 0, &sse, 0);
21 *status = fenv_encode(x87 & excepts, sse & excepts);
22#else
23 *status = fenv_encode(0, __mingw_statusfp() & excepts);
24#endif
25 return 0;
26}