From 08f772e6ab7e10ae58900b8d0620354d3763be16 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Fri, 21 May 2021 14:21:51 +0200 Subject: [PATCH] fenv: provide environment primitives --- sh3eb/fenv-softfloat.h | 5 ++--- sh3eb/fenv.c | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sh3eb/fenv-softfloat.h b/sh3eb/fenv-softfloat.h index 0511335..3cf8ade 100644 --- a/sh3eb/fenv-softfloat.h +++ b/sh3eb/fenv-softfloat.h @@ -55,7 +55,6 @@ extern int __softfloat_float_exception_flags; extern int __softfloat_float_exception_mask; extern int __softfloat_float_rounding_mode; -void __softfloat_float_raise(int); __fenv_static inline int feclearexcept(int __excepts) @@ -86,7 +85,7 @@ __fenv_static inline int feraiseexcept(int __excepts) { - __softfloat_float_raise(__excepts); + __softfloat_float_exception_flags |= __excepts; return (0); } @@ -181,4 +180,4 @@ fegetexcept(void) return (__softfloat_float_exception_mask); } -#endif /* __BSD_VISIBLE */ \ No newline at end of file +#endif /* __BSD_VISIBLE */ diff --git a/sh3eb/fenv.c b/sh3eb/fenv.c index 7cc6ad4..efe90cb 100644 --- a/sh3eb/fenv.c +++ b/sh3eb/fenv.c @@ -29,6 +29,8 @@ #define __fenv_static #include "openlibm_fenv.h" +#include + #ifdef __GNUC_GNU_INLINE__ #error "This file must be compiled with C99 'inline' semantics" #endif @@ -39,6 +41,10 @@ */ const fenv_t __fe_dfl_env = 0; +int __softfloat_float_exception_flags = 0; +int __softfloat_float_exception_mask = 0; +int __softfloat_float_rounding_mode = FLT_ROUNDS; + #define __set_env(env, flags, mask, rnd) env = ((flags) \ | (mask)<<_FPUSW_SHIFT \ | (rnd) << 24)