fegetexcept.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. /* Get floating-point exceptions.
  6. Copyright (C) 2001-2013 Free Software Foundation, Inc.
  7. Contributed by Philip Blundell <philb@gnu.org>, 2001
  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 "fenv_libc.h"
  21. #include <fpu_control.h>
  22. int
  23. fegetexcept (void)
  24. {
  25. #ifdef __NDS32_ABI_2FP_PLUS__
  26. unsigned long temp;
  27. _FPU_GETCW (temp);
  28. return (temp & ENABLE_MASK) >> ENABLE_SHIFT;
  29. #else
  30. /* Unsupported. Return all exceptions disabled. */
  31. return 0;
  32. #endif
  33. }