summaryrefslogtreecommitdiff
path: root/libm/sh/feholdexcpt.c
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2009-01-14 12:49:24 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2009-01-14 12:49:24 +0000
commitc617dd785dde62eb0862c576f679fdd43dcd3a9a (patch)
tree2becfd05a424b92df048332c064f51de847f4c70 /libm/sh/feholdexcpt.c
parent4c20772b6223bf193dd0f9ec70a3766d3a22c30b (diff)
libm_sh: Re-added sh specific files erroneously removed recently,
and moved under a better folder. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libm/sh/feholdexcpt.c')
-rw-r--r--libm/sh/feholdexcpt.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/libm/sh/feholdexcpt.c b/libm/sh/feholdexcpt.c
new file mode 100644
index 000000000..1af79b31f
--- /dev/null
+++ b/libm/sh/feholdexcpt.c
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright (c) 2007 STMicroelectronics Ltd
+ * Filippo Arcidiacono (filippo.arcidiacono@st.com)
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ *
+ * Taken from glibc 2.6
+ *
+ */
+
+#include <fenv.h>
+#include <fpu_control.h>
+
+int
+feholdexcept (fenv_t *envp)
+{
+ unsigned long int temp;
+
+ /* Store the environment. */
+ _FPU_GETCW (temp);
+ envp->__fpscr = temp;
+
+ /* Now set all exceptions to non-stop. */
+ temp &= ~FE_ALL_EXCEPT;
+ _FPU_SETCW (temp);
+
+ return 1;
+}
+libm_hidden_def (feholdexcept)