diff options
author | das <das@FreeBSD.org> | 2005-03-16 19:03:46 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2005-03-16 19:03:46 +0000 |
commit | 6448887f3bd81c49f6bad7a48dc2c5b80eab84cb (patch) | |
tree | ed1345d1aaf08f9b2af1cfc6cc10e15b82d917d1 /lib/msun/ia64 | |
parent | f472dda708da18436fce04e1b640051e98b0bcf9 (diff) | |
download | FreeBSD-src-6448887f3bd81c49f6bad7a48dc2c5b80eab84cb.zip FreeBSD-src-6448887f3bd81c49f6bad7a48dc2c5b80eab84cb.tar.gz |
Replace fegetmask() and fesetmask() with feenableexcept(),
fedisableexcept(), and fegetexcept(). These two sets of routines
provide the same functionality. I implemented the former as an
undocumented internal interface to make the regression test easier to
write. However, fe(enable|disable|get)except() is already part of
glibc, and I would like to avoid gratuitous differences. The only
major flaw in the glibc API is that there's no good way to report
errors on processors that don't support all the unmasked exceptions.
Diffstat (limited to 'lib/msun/ia64')
-rw-r--r-- | lib/msun/ia64/fenv.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/msun/ia64/fenv.h b/lib/msun/ia64/fenv.h index 98992b1..6f0240f 100644 --- a/lib/msun/ia64/fenv.h +++ b/lib/msun/ia64/fenv.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004 David Schultz <das@FreeBSD.ORG> + * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -205,18 +205,29 @@ int feupdateenv(const fenv_t *__envp); #if __BSD_VISIBLE static __inline int -fesetmask(int __mask) +feenableexcept(int __mask) { fenv_t __newfpsr, __oldfpsr; __stfpsr(&__oldfpsr); - __newfpsr = (__oldfpsr | FE_ALL_EXCEPT) & ~__mask; + __newfpsr = __oldfpsr & ~(__mask & FE_ALL_EXCEPT); __ldfpsr(__newfpsr); return (~__oldfpsr & FE_ALL_EXCEPT); } static __inline int -fegetmask(void) +fedisableexcept(int __mask) +{ + fenv_t __newfpsr, __oldfpsr; + + __stfpsr(&__oldfpsr); + __newfpsr = __oldfpsr | (__mask & FE_ALL_EXCEPT); + __ldfpsr(__newfpsr); + return (~__oldfpsr & FE_ALL_EXCEPT); +} + +static __inline int +fegetexcept(void) { fenv_t __fpsr; |