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/sparc64 | |
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/sparc64')
-rw-r--r-- | lib/msun/sparc64/fenv.h | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/msun/sparc64/fenv.h b/lib/msun/sparc64/fenv.h index b425515..8273299 100644 --- a/lib/msun/sparc64/fenv.h +++ b/lib/msun/sparc64/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 @@ -217,19 +217,29 @@ feupdateenv(const fenv_t *__envp) #if __BSD_VISIBLE static __inline int -fesetmask(int __mask) +feenableexcept(int __mask) { - fenv_t __r; + fenv_t __old_r, __new_r; - __stxfsr(&__r); - __r &= ~_ENABLE_MASK; - __r |= __mask << _FPUSW_SHIFT; - __ldxfsr(__r); - return (0); + __stxfsr(&__old_r); + __new_r = __old_r | ((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT); + __ldxfsr(__new_r); + return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); +} + +static __inline int +fedisableexcept(int __mask) +{ + fenv_t __old_r, __new_r; + + __stxfsr(&__old_r); + __new_r = __old_r & ~((__mask & FE_ALL_EXCEPT) << _FPUSW_SHIFT); + __ldxfsr(__new_r); + return ((__old_r >> _FPUSW_SHIFT) & FE_ALL_EXCEPT); } static __inline int -fegetmask(void) +fegetexcept(void) { fenv_t __r; |