feholdexcpt.c 507 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. *
  3. * Copyright (c) 2007 STMicroelectronics Ltd
  4. * Filippo Arcidiacono (filippo.arcidiacono@st.com)
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. *
  8. * Taken from glibc 2.6
  9. *
  10. */
  11. #include <fenv.h>
  12. #include <fpu_control.h>
  13. int
  14. feholdexcept (fenv_t *envp)
  15. {
  16. unsigned long int temp;
  17. /* Store the environment. */
  18. _FPU_GETCW (temp);
  19. envp->__fpscr = temp;
  20. /* Now set all exceptions to non-stop. */
  21. temp &= ~FE_ALL_EXCEPT;
  22. _FPU_SETCW (temp);
  23. return 1;
  24. }