From: Taylor R Campbell Date: Sat, 22 Feb 2014 22:29:31 +0000 (+0000) Subject: Simplify x86 fenv structures. X-Git-Tag: release-9.2.0~44 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=7babf433f2351ffd4d88c94a09421eb2a937f3dc;p=mit-scheme.git Simplify x86 fenv structures. Avoid needless typedefs and unions. --- diff --git a/src/microcode/cmpintmd/x86-fenv.c b/src/microcode/cmpintmd/x86-fenv.c index 27a188781..5168121f6 100644 --- a/src/microcode/cmpintmd/x86-fenv.c +++ b/src/microcode/cmpintmd/x86-fenv.c @@ -104,10 +104,10 @@ feclearexcept (int excepts) x87_clear_exceptions (); else { - x87_fenv_t fenv; - x87_read_environment (fenv.environment_bytes); - (fenv.environment.x87_status_word) &=~ excepts; - x87_write_environment (fenv.environment_bytes); + struct x87_fenv fenv; + x87_read_environment (&fenv); + (fenv.x87_status_word) &=~ excepts; + x87_write_environment (&fenv); } } return (! (sse_p || x87_p)); @@ -122,10 +122,10 @@ feraiseexcept (int excepts) sse_write_mxcsr ((sse_read_mxcsr ()) | excepts); if (x87_p) { - x87_fenv_t fenv; - x87_read_environment (fenv.environment_bytes); - (fenv.environment.x87_status_word) |= excepts; - x87_write_environment (fenv.environment_bytes); + struct x87_fenv fenv; + x87_read_environment (&fenv); + (fenv.x87_status_word) |= excepts; + x87_write_environment (&fenv); x87_trap_exceptions (); } /* There seems to be no good way to request a trap in SSE. @@ -154,10 +154,10 @@ fesetexceptflag (const fexcept_t *flagp, int excepts) sse_write_mxcsr ((sse_read_mxcsr ()) | ((*flagp) & excepts)); if (x87_p) { - x87_fenv_t fenv; - x87_read_environment (fenv.environment_bytes); - (fenv.environment.x87_status_word) |= ((*flagp) & excepts); - x87_write_environment (fenv.environment_bytes); + struct x87_fenv fenv; + x87_read_environment (&fenv); + (fenv.x87_status_word) |= ((*flagp) & excepts); + x87_write_environment (&fenv); } return (! (sse_p || x87_p)); } @@ -220,7 +220,7 @@ fegetenv (fenv_t *envp) if (sse_p) (envp->fenv_sse.sse_mxcsr) = (sse_read_mxcsr ()); if (x87_p) - x87_read_environment (envp->fenv_x87.environment_bytes); + x87_read_environment (&envp->fenv_x87); return (! (sse_p || x87_p)); } @@ -230,7 +230,7 @@ fesetenv (const fenv_t *envp) if (sse_p) sse_write_mxcsr (envp->fenv_sse.sse_mxcsr); if (x87_p) - x87_write_environment (envp->fenv_x87.environment_bytes); + x87_write_environment (&envp->fenv_x87); return (! (sse_p || x87_p)); } @@ -249,7 +249,7 @@ feholdexcept (fenv_t *envp) { x87_clear_exceptions (); x87_write_control_word - ((envp->fenv_x87.environment.x87_control_word) | FE_ALL_EXCEPT); + ((envp->fenv_x87.x87_control_word) | FE_ALL_EXCEPT); } return (0); } diff --git a/src/microcode/cmpintmd/x86-fenv.h b/src/microcode/cmpintmd/x86-fenv.h index 9fa23e091..98b25d2fd 100644 --- a/src/microcode/cmpintmd/x86-fenv.h +++ b/src/microcode/cmpintmd/x86-fenv.h @@ -31,14 +31,14 @@ USA. typedef int fexcept_t; -typedef struct +struct sse_fenv { int sse_mxcsr; -} sse_fenv_t; +}; /* FIXME: This structure needs to be packed. */ -struct x87_environment +struct x87_fenv { unsigned short x87_control_word; unsigned short x87_unused1; @@ -55,16 +55,10 @@ struct x87_environment unsigned short x87_unused5; }; -typedef union -{ - struct x87_environment environment; - unsigned char environment_bytes [sizeof (struct x87_environment)]; -} x87_fenv_t; - typedef struct { - sse_fenv_t fenv_sse; - x87_fenv_t fenv_x87; + struct sse_fenv fenv_sse; + struct x87_fenv fenv_x87; } fenv_t; #define FE_TONEAREST 0