Back to index

glibc  2.9
ftestexcept.c
Go to the documentation of this file.
00001 /* Test exception in current environment.
00002    Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with GCC; see the file COPYING.  If not, write to the Free
00017    Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
00018    02110-1301, USA.  */
00019 
00020 #include <fenv.h>
00021 #include <fpu_control.h>
00022 
00023 #include <unistd.h>
00024 #include <ldsodefs.h>
00025 #include <dl-procinfo.h>
00026 #include <sysdep.h>
00027 
00028 int
00029 fetestexcept (int excepts)
00030 {
00031   if (GLRO (dl_hwcap) & HWCAP_ARM_VFP)
00032     {
00033       fexcept_t temp;
00034 
00035       /* Get current exceptions.  */
00036       _FPU_GETCW(temp);
00037 
00038       return temp & excepts & FE_ALL_EXCEPT;
00039     }
00040 
00041   /* Unsupported, return 0.  */
00042   return 0;
00043 }