1999-11-01 00:16:36 +00:00
|
|
|
/* Store current representation for exceptions.
|
2016-01-04 16:05:18 +00:00
|
|
|
Copyright (C) 1998-2016 Free Software Foundation, Inc.
|
1999-11-01 00:16:36 +00:00
|
|
|
This file is part of the GNU C Library.
|
2000-03-29 11:18:48 +00:00
|
|
|
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
|
1999-11-01 00:16:36 +00:00
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:56:23 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1999-11-01 00:16:36 +00:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:56:23 +00:00
|
|
|
Lesser General Public License for more details.
|
1999-11-01 00:16:36 +00:00
|
|
|
|
2001-07-06 04:56:23 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-03-09 23:56:38 +00:00
|
|
|
License along with the GNU C Library. If not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1999-11-01 00:16:36 +00:00
|
|
|
|
|
|
|
#include <fenv.h>
|
|
|
|
#include <fpu_control.h>
|
|
|
|
|
|
|
|
int
|
2002-09-10 11:24:50 +00:00
|
|
|
fegetexceptflag (fexcept_t *flagp, int excepts)
|
1999-11-01 00:16:36 +00:00
|
|
|
{
|
2008-03-26 13:21:26 +00:00
|
|
|
fpu_control_t temp;
|
1999-11-01 00:16:36 +00:00
|
|
|
|
|
|
|
/* Get the current exceptions. */
|
|
|
|
_FPU_GETCW (temp);
|
|
|
|
|
2013-06-05 20:26:40 +00:00
|
|
|
/* We only save the relevant bits here. In particular, care has to be
|
2002-09-10 11:24:50 +00:00
|
|
|
taken with the CAUSE bits, as an inadvertent restore later on could
|
|
|
|
generate unexpected exceptions. */
|
2002-03-17 12:07:44 +00:00
|
|
|
|
1999-11-01 00:16:36 +00:00
|
|
|
*flagp = temp & excepts & FE_ALL_EXCEPT;
|
|
|
|
|
|
|
|
/* Success. */
|
|
|
|
return 0;
|
|
|
|
}
|