fgetexcptflg.c 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. */
  5. /* Store current representation for exceptions.
  6. Copyright (C) 1997-2013 Free Software Foundation, Inc.
  7. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
  8. The GNU C Library is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU Lesser General Public
  10. License as published by the Free Software Foundation; either
  11. version 2.1 of the License, or (at your option) any later version.
  12. The GNU C Library is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. Lesser General Public License for more details.
  16. You should have received a copy of the GNU Lesser General Public
  17. License along with the GNU C Library. If not, see
  18. <http://www.gnu.org/licenses/>. */
  19. #include <fenv.h>
  20. #include <fpu_control.h>
  21. int
  22. fegetexceptflag (fexcept_t *flagp, int excepts)
  23. {
  24. #ifdef __NDS32_ABI_2FP_PLUS__
  25. fpu_control_t temp;
  26. /* Get the current exceptions. */
  27. _FPU_GETCW (temp);
  28. *flagp = temp & excepts & FE_ALL_EXCEPT;
  29. /* Success. */
  30. return 0;
  31. #else
  32. /* Unsupported, so fail. */
  33. return 1;
  34. #endif
  35. }