Update copyright notices with scripts/update-copyrights
[glibc.git] / sysdeps / powerpc / powerpc32 / e500 / nofpu / fsetexcptflg.c
blob12a1a515e6b8051f7d3ae7236062ed8f16b9b454
1 /* Set floating-point environment exception handling. e500 version.
2 Copyright (C) 1997-2014 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
19 #include <fenv_libc.h>
21 int
22 __fesetexceptflag (const fexcept_t *flagp, int excepts)
24 unsigned long old_spefscr, spefscr;
25 fexcept_t flag;
26 int excepts_spe = __fexcepts_to_spe (excepts);
28 /* Get the current state. */
29 old_spefscr = fegetenv_register ();
31 /* Ignore exceptions not listed in 'excepts'. */
32 flag = *flagp & excepts_spe;
34 /* Replace the exception status */
35 spefscr = (old_spefscr & ~excepts_spe) | flag;
37 /* Store the new status word (along with the rest of the environment). */
38 fesetenv_register (spefscr);
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 ();
45 /* Success. */
46 return 0;
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
55 versioned_symbol (libm, __fesetexceptflag, fesetexceptflag, GLIBC_2_2);