📄 fpusetup.c
字号:
/***********************************************************************
* If used, causes certain invalid mathematical operations to generate
* a SIGFPE and dump core rather than silently proceeding. For
* normal operation, this should never happen. It is most useful,
* therefore, in tracking down subtle numerical bugs.
*
* If INHIBIT_FPU_CONTROL is defined or the OS is not ix86-linux,
* the function returns without changing anything.
**********************************************************************/
/*
* This file is part of tMCimg.
*
* tMCimg is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program 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 General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
/* This can also be done through the GSL, save that for later */
#if (DO_FPU_CONTROL)
# if (HAVE_FPU_CONTROL_H)
# include <fpu_control.h>
# else
# error "FPU control requested but header file not found"
# endif
#endif
#if (DO_FPU_CONTROL)
void fpusetup(void)
{
fpu_control_t fpu;
_FPU_GETCW(fpu);
/*
* If not masked off (as is the default), these raise an interrupt
* which gets turned into a SIGFPE by the C runtime libraries.
*
* _FPU_MASK_IM: Invalid operation mask
* _FPU_MASK_DM: Denormalized operand mask
* _FPU_MASK_ZM: Zero-divide mask
* _FPU_MASK_OM: Overflow mask
* _FPU_MASK_UM: Underflow mask
* _FPU_MASK_PM: Precision (inexact result) mask
*/
/* Take off some of the masks */
#if 0
fpu &= ~(_FPU_MASK_IM | _FPU_MASK_ZM |
_FPU_MASK_OM | _FPU_MASK_UM | _FPU_MASK_DM);
#else
fpu &= ~(_FPU_MASK_IM | _FPU_MASK_ZM );
#endif
fpu &= ~(_FPU_EXTENDED);
fpu |= _FPU_DOUBLE;
_FPU_SETCW(fpu);
return;
}
#else /* !DO_FPU_CONTROL */
void fpusetup(void)
{
/* Return without changing anything */
return;
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -