* mingwex/fe*.c: Revert previous changes.

* include/fenv.h: Revert previous changes.

	Add Changelog entry for the reverted change.
This commit is contained in:
Danny Smith 2005-08-25 08:39:54 +00:00
parent b9ebff640a
commit 9e28e551f2
9 changed files with 42 additions and 14 deletions

View File

@ -1,3 +1,22 @@
2005-08-25 Danny Smith <dannysmith@users.sourceforge.net>
* mingwex/fe*.c: Revert previous changes.
* include/fenv.h: Revert previous changes.
2005-08-25 Danny Smith <dannysmith@users.sourceforge.net>
* mingwex/feclearexcept.c (feclearexcept): Change declaration.
Do not return a value.
* mingwex/fegetexceptflag.c (fegetexceptflag): Likewise.
* mingwex/feraiseexcept.c (feraiseexcept): Likewise.
* mingwex/fesetexceptflag.c (fesetexceptflag): Likewise.
* mingwex/fegetenv.c (fegetenv): Likewise.
* mingwex/fesetenv.c (fesetenv): Likewise.
* mingwex/feupdateenv.c (feupdateenv): Likewise.
* include/fenv.h (feclearexcept, fegetexceptflag, feraiseexcept,
fesetexceptflag, fegetenv, fesetenv, feupdateenv): Correct
prototypes.
2005-08-25 Danny Smith <dannysmith@users.sourceforge.net>
* mingwex/stdio/fseeko64.c (fseeko64): Flush stream before

View File

@ -65,10 +65,10 @@ extern "C" {
/*TODO: Some of these could be inlined */
/* 7.6.2 Exception */
extern void __cdecl feclearexcept (int);
extern void __cdecl fegetexceptflag (fexcept_t * flagp, int excepts);
extern void __cdecl feraiseexcept (int excepts );
extern void __cdecl fesetexceptflag (const fexcept_t *, int);
extern int __cdecl feclearexcept (int);
extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts);
extern int __cdecl feraiseexcept (int excepts );
extern int __cdecl fesetexceptflag (const fexcept_t *, int);
extern int __cdecl fetestexcept (int excepts);
/* 7.6.3 Rounding */
@ -78,9 +78,9 @@ extern int __cdecl fesetround (int mode);
/* 7.6.4 Environment */
extern void __cdecl fegetenv (fenv_t * envp);
extern void __cdecl fesetenv (const fenv_t * );
extern void __cdecl feupdateenv (const fenv_t *);
extern int __cdecl fegetenv (fenv_t * envp);
extern int __cdecl fesetenv (const fenv_t * );
extern int __cdecl feupdateenv (const fenv_t *);
extern int __cdecl feholdexcept (fenv_t *);
#ifdef __cplusplus

View File

@ -4,10 +4,12 @@
The feclearexcept function clears the supported exceptions
represented by its argument. */
void feclearexcept (int excepts)
int feclearexcept (int excepts)
{
fenv_t _env;
__asm__ volatile ("fnstenv %0;" : "=m" (_env)); /* get the env */
_env.__status_word &= ~(excepts & FE_ALL_EXCEPT); /* clear the except */
__asm__ volatile ("fldenv %0;" :: "m" (_env)); /*set the env */
return 0;
}

View File

@ -4,8 +4,9 @@
The fegetenv function stores the current floating-point environment
in the object pointed to by envp. */
void fegetenv (fenv_t * envp)
int fegetenv (fenv_t * envp)
{
__asm__ ("fnstenv %0;": "=m" (*envp));
return 0;
}

View File

@ -6,9 +6,10 @@
representation of the exception flags indicated by the argument
excepts in the object pointed to by the argument flagp. */
void fegetexceptflag (fexcept_t * flagp, int excepts)
int fegetexceptflag (fexcept_t * flagp, int excepts)
{
unsigned short _sw;
__asm__ ("fnstsw %%ax;": "=a" (_sw));
*flagp = _sw & excepts & FE_ALL_EXCEPT;
return 0;
}

View File

@ -8,11 +8,12 @@
the inexact exception whenever it raises the overflow
or underflow exception is implementation-defined. */
void feraiseexcept (int excepts)
int feraiseexcept (int excepts)
{
fenv_t _env;
__asm__ volatile ("fnstenv %0;" : "=m" (_env));
_env.__status_word |= excepts & FE_ALL_EXCEPT;
__asm__ volatile ("fldenv %0;"
"fwait;" : : "m" (_env));
return 0;
}

View File

@ -13,7 +13,7 @@
extern void (*_imp___fpreset)( void ) ;
void fesetenv (const fenv_t * envp)
int fesetenv (const fenv_t * envp)
{
if (envp == FE_PC64_ENV)
/*
@ -38,4 +38,6 @@ void fesetenv (const fenv_t * envp)
else
__asm__ ("fldenv %0;" : : "m" (*envp));
return 0;
}

View File

@ -9,7 +9,7 @@
represented by the argument excepts. This function does not raise
exceptions, but only sets the state of the flags. */
void fesetexceptflag (const fexcept_t * flagp, int excepts)
int fesetexceptflag (const fexcept_t * flagp, int excepts)
{
fenv_t _env;
@ -18,4 +18,5 @@ void fesetexceptflag (const fexcept_t * flagp, int excepts)
_env.__status_word &= ~excepts;
_env.__status_word |= (*flagp & excepts);
__asm__ volatile ("fldenv %0;" : : "m" (_env));
return 0;
}

View File

@ -10,10 +10,11 @@
/* FIXME: this works but surely there must be a better way. */
void feupdateenv (const fenv_t * envp)
int feupdateenv (const fenv_t * envp)
{
unsigned int _fexcept = fetestexcept (FE_ALL_EXCEPT); /*save excepts */
fesetenv (envp); /* install the env */
feraiseexcept (_fexcept); /* raise the execept */
return 0;
}