flt_rounds.c

来自「在x86平台上运行不可信任代码的sandbox。」· C语言 代码 · 共 23 行

C
23
字号
/* * Written by J.T. Conklin, Apr 10, 1995 * Public domain. */#include <float.h>static const int map[] = {	1,	/* round to nearest */	3,	/* round to zero */	2,	/* round to negative infinity */	0	/* round to positive infinity */};int__flt_rounds(void){	int x;	__asm("fnstcw %0" : "=m" (x));        return (map[(x >> 10) & 0x03]);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?