bump to 1.0.32 for release
[uclibc-ng.git] / libm / nds32 / fclrexcpt.c
blob938f15a25c51d276be832b5825ede3ed198968d7
1 /*
2 * Copyright (C) 2016-2017 Andes Technology, Inc.
3 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
4 */
6 /* Clear given exceptions in current floating-point environment.
7 Copyright (C) 1997-2013 Free Software Foundation, Inc.
9 The GNU C Library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Lesser General Public
11 License as published by the Free Software Foundation; either
12 version 2.1 of the License, or (at your option) any later version.
14 The GNU C Library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public
20 License along with the GNU C Library. If not, see
21 <http://www.gnu.org/licenses/>. */
23 #include <fenv.h>
24 #include "fenv_libc.h"
25 #include <fpu_control.h>
28 int
29 feclearexcept (int excepts)
31 #ifdef __NDS32_ABI_2FP_PLUS__
32 unsigned long int temp;
34 /* Mask out unsupported bits/exceptions. */
35 excepts &= FE_ALL_EXCEPT;
37 /* Get the current floating point status. */
38 _FPU_GETCW (temp);
40 /* Clear the relevant bits. */
41 temp &= ~excepts;
43 /* Put the new data in effect. */
44 _FPU_SETCW (temp);
46 /* Success. */
47 return 0;
48 #else
49 /* Unsupported, so fail unless nothing needs to be done. */
50 return (excepts != 0);
51 #endif