From 818507cb9092d3f7bab606b884cb7353484070a9 Mon Sep 17 00:00:00 2001 From: das Date: Fri, 21 Oct 2011 06:25:31 +0000 Subject: Bugfix: feenableexcept() and fedisableexcept() should just return the old exception mask, not mask | ~FE_ALL_EXCEPT. MFC after: 2 weeks --- lib/msun/amd64/fenv.c | 8 ++++---- lib/msun/i387/fenv.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/msun/amd64/fenv.c b/lib/msun/amd64/fenv.c index bd267e5..8b49b35 100644 --- a/lib/msun/amd64/fenv.c +++ b/lib/msun/amd64/fenv.c @@ -135,12 +135,12 @@ __feenableexcept(int mask) mask &= FE_ALL_EXCEPT; __fnstcw(&control); __stmxcsr(&mxcsr); - omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; + omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; control &= ~mask; __fldcw(control); mxcsr &= ~(mask << _SSE_EMASK_SHIFT); __ldmxcsr(mxcsr); - return (~omask); + return (omask); } int @@ -152,12 +152,12 @@ __fedisableexcept(int mask) mask &= FE_ALL_EXCEPT; __fnstcw(&control); __stmxcsr(&mxcsr); - omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; + omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; control |= mask; __fldcw(control); mxcsr |= mask << _SSE_EMASK_SHIFT; __ldmxcsr(mxcsr); - return (~omask); + return (omask); } __weak_reference(__feenableexcept, feenableexcept); diff --git a/lib/msun/i387/fenv.c b/lib/msun/i387/fenv.c index fafe220..6f51ba2 100644 --- a/lib/msun/i387/fenv.c +++ b/lib/msun/i387/fenv.c @@ -192,14 +192,14 @@ __feenableexcept(int mask) __stmxcsr(&mxcsr); else mxcsr = 0; - omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; + omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; control &= ~mask; __fldcw(control); if (__HAS_SSE()) { mxcsr &= ~(mask << _SSE_EMASK_SHIFT); __ldmxcsr(mxcsr); } - return (~omask); + return (omask); } int @@ -214,14 +214,14 @@ __fedisableexcept(int mask) __stmxcsr(&mxcsr); else mxcsr = 0; - omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; + omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; control |= mask; __fldcw(control); if (__HAS_SSE()) { mxcsr |= mask << _SSE_EMASK_SHIFT; __ldmxcsr(mxcsr); } - return (~omask); + return (omask); } __weak_reference(__feenableexcept, feenableexcept); -- cgit v1.1