📄 _ftou.c
字号:
#ifndef lintstatic char sccsid[] = "@(#)_ftou.c 1.1 92/07/30 SMI";#endif/* * Copyright (c) 1987 by Sun Microsystems, Inc. */unsigned _dtou(d) double d;{ /* Convert double to unsigned. */ int id; /* * id = d is correct if 0 <= d < 2**31, and good enough if d is NaN * or d < 0 or d >= 2**32. Otherwise, since the result (int) d of * converting 2**31 <= d < 2**32 is unknown, adjust d before the * conversion. */ if (d >= 2147483648.0) id = 0x80000000 | (int) (d - 2147483648.0); else id = (int) d; return (unsigned) id;}unsigned _ftou(dd) int dd; /* really float */{ /* Convert float to unsigned. */ int id; double d = (double) *((float *)(&dd)); /* * id = d is correct if 0 <= d < 2**31, and good enough if d is NaN * or d < 0 or d >= 2**32. Otherwise, since the result (int) d of * converting 2**31 <= d < 2**32 is unknown, adjust d before the * conversion. */ if (d >= 2147483648.0) id = 0x80000000 | (int) (d - 2147483648.0); else id = (int) d; return (unsigned) id;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -