]>
Commit | Line | Data |
---|---|---|
3c8325fb | 1 | /* Set floating-point environment exception handling. e500 version. |
f7a9f785 | 2 | Copyright (C) 1997-2016 Free Software Foundation, Inc. |
3c8325fb JM |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with the GNU C Library; if not, see | |
17 | <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | #include <fenv_libc.h> | |
20 | ||
21 | int | |
22 | __fesetexceptflag (const fexcept_t *flagp, int excepts) | |
23 | { | |
24 | unsigned long old_spefscr, spefscr; | |
25 | fexcept_t flag; | |
26 | int excepts_spe = __fexcepts_to_spe (excepts); | |
27 | ||
28 | /* Get the current state. */ | |
29 | old_spefscr = fegetenv_register (); | |
30 | ||
31 | /* Ignore exceptions not listed in 'excepts'. */ | |
32 | flag = *flagp & excepts_spe; | |
33 | ||
34 | /* Replace the exception status */ | |
35 | spefscr = (old_spefscr & ~excepts_spe) | flag; | |
36 | ||
37 | /* Store the new status word (along with the rest of the environment). */ | |
38 | fesetenv_register (spefscr); | |
39 | ||
40 | /* If the state of the "invalid" or "underflow" flag has changed, | |
41 | inform the kernel. */ | |
42 | if (((spefscr ^ old_spefscr) & (SPEFSCR_FINVS | SPEFSCR_FUNFS)) != 0) | |
43 | __fe_note_change (); | |
44 | ||
45 | /* Success. */ | |
46 | return 0; | |
47 | } | |
48 | ||
49 | #include <shlib-compat.h> | |
50 | #if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2) | |
51 | strong_alias (__fesetexceptflag, __old_fesetexceptflag) | |
52 | compat_symbol (libm, __old_fesetexceptflag, fesetexceptflag, GLIBC_2_1); | |
53 | #endif | |
54 | ||
55 | versioned_symbol (libm, __fesetexceptflag, fesetexceptflag, GLIBC_2_2); |