Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

362 lines
7.1 KiB

  1. /***
  2. *fpieee.h - Definitions for floating point IEEE exception handling
  3. *
  4. * Copyright (c) 1991-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file contains constant and type definitions for handling
  8. * floating point exceptions [ANSI/IEEE std. 754]
  9. *
  10. * [Public]
  11. *
  12. ****/
  13. #if _MSC_VER > 1000
  14. #pragma once
  15. #endif
  16. #ifndef _INC_FPIEEE
  17. #define _INC_FPIEEE
  18. #if !defined(_WIN32)
  19. #error ERROR: Only Win32 target supported!
  20. #endif
  21. #ifndef __assembler /* MIPS ONLY: Protect from assembler */
  22. #ifdef _MSC_VER
  23. /*
  24. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  25. * alignment.
  26. */
  27. #pragma pack(push,8)
  28. /* Disable C4324: structure was padded due to __declspec(align()) */
  29. #pragma warning(push)
  30. #pragma warning(disable: 4324)
  31. #endif /* _MSC_VER */
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. /* Define _CRTIMP */
  36. #ifndef _CRTIMP
  37. #ifdef _DLL
  38. #define _CRTIMP __declspec(dllimport)
  39. #else /* ndef _DLL */
  40. #define _CRTIMP
  41. #endif /* _DLL */
  42. #endif /* _CRTIMP */
  43. /* Define __cdecl for non-Microsoft compilers */
  44. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  45. #define __cdecl
  46. #endif
  47. /*
  48. * Define floating point IEEE compare result values.
  49. */
  50. typedef enum {
  51. _FpCompareEqual,
  52. _FpCompareGreater,
  53. _FpCompareLess,
  54. _FpCompareUnordered
  55. } _FPIEEE_COMPARE_RESULT;
  56. /*
  57. * Define floating point format and result precision values.
  58. */
  59. typedef enum {
  60. _FpFormatFp32,
  61. _FpFormatFp64,
  62. _FpFormatFp80,
  63. _FpFormatFp128,
  64. _FpFormatI16,
  65. _FpFormatI32,
  66. _FpFormatI64,
  67. _FpFormatU16,
  68. _FpFormatU32,
  69. _FpFormatU64,
  70. _FpFormatBcd80,
  71. _FpFormatCompare,
  72. _FpFormatString,
  73. #if defined(_M_IA64)
  74. _FpFormatFp82
  75. #endif
  76. } _FPIEEE_FORMAT;
  77. /*
  78. * Define operation code values.
  79. */
  80. typedef enum {
  81. _FpCodeUnspecified,
  82. _FpCodeAdd,
  83. _FpCodeSubtract,
  84. _FpCodeMultiply,
  85. _FpCodeDivide,
  86. _FpCodeSquareRoot,
  87. _FpCodeRemainder,
  88. _FpCodeCompare,
  89. _FpCodeConvert,
  90. _FpCodeRound,
  91. _FpCodeTruncate,
  92. _FpCodeFloor,
  93. _FpCodeCeil,
  94. _FpCodeAcos,
  95. _FpCodeAsin,
  96. _FpCodeAtan,
  97. _FpCodeAtan2,
  98. _FpCodeCabs,
  99. _FpCodeCos,
  100. _FpCodeCosh,
  101. _FpCodeExp,
  102. _FpCodeFabs,
  103. _FpCodeFmod,
  104. _FpCodeFrexp,
  105. _FpCodeHypot,
  106. _FpCodeLdexp,
  107. _FpCodeLog,
  108. _FpCodeLog10,
  109. _FpCodeModf,
  110. _FpCodePow,
  111. _FpCodeSin,
  112. _FpCodeSinh,
  113. _FpCodeTan,
  114. _FpCodeTanh,
  115. _FpCodeY0,
  116. _FpCodeY1,
  117. _FpCodeYn,
  118. _FpCodeLogb,
  119. _FpCodeNextafter,
  120. _FpCodeNegate,
  121. _FpCodeFmin, /* XMMI */
  122. _FpCodeFmax, /* XMMI */
  123. _FpCodeConvertTrunc, /* XMMI */
  124. _XMMIAddps, /* XMMI */
  125. _XMMIAddss,
  126. _XMMISubps,
  127. _XMMISubss,
  128. _XMMIMulps,
  129. _XMMIMulss,
  130. _XMMIDivps,
  131. _XMMIDivss,
  132. _XMMISqrtps,
  133. _XMMISqrtss,
  134. _XMMIMaxps,
  135. _XMMIMaxss,
  136. _XMMIMinps,
  137. _XMMIMinss,
  138. _XMMICmpps,
  139. _XMMICmpss,
  140. _XMMIComiss,
  141. _XMMIUComiss,
  142. _XMMICvtpi2ps,
  143. _XMMICvtsi2ss,
  144. _XMMICvtps2pi,
  145. _XMMICvtss2si,
  146. _XMMICvttps2pi,
  147. _XMMICvttss2si,
  148. _XMMI2Addpd, /* XMMI2 */
  149. _XMMI2Addsd,
  150. _XMMI2Subpd,
  151. _XMMI2Subsd,
  152. _XMMI2Mulpd,
  153. _XMMI2Mulsd,
  154. _XMMI2Divpd,
  155. _XMMI2Divsd,
  156. _XMMI2Sqrtpd,
  157. _XMMI2Sqrtsd,
  158. _XMMI2Maxpd,
  159. _XMMI2Maxsd,
  160. _XMMI2Minpd,
  161. _XMMI2Minsd,
  162. _XMMI2Cmppd,
  163. _XMMI2Cmpsd,
  164. _XMMI2Comisd,
  165. _XMMI2UComisd,
  166. _XMMI2Cvtpd2pi, /* 66 2D */
  167. _XMMI2Cvtsd2si, /* F2 */
  168. _XMMI2Cvttpd2pi, /* 66 2C */
  169. _XMMI2Cvttsd2si, /* F2 */
  170. _XMMI2Cvtps2pd, /* 0F 5A */
  171. _XMMI2Cvtss2sd, /* F3 */
  172. _XMMI2Cvtpd2ps, /* 66 */
  173. _XMMI2Cvtsd2ss, /* F2 */
  174. _XMMI2Cvtdq2ps, /* 0F 5B */
  175. _XMMI2Cvttps2dq, /* F3 */
  176. _XMMI2Cvtps2dq, /* 66 */
  177. _XMMI2Cvttpd2dq, /* 66 0F E6 */
  178. _XMMI2Cvtpd2dq, /* F2 */
  179. #if defined(_M_IA64)
  180. _FpCodeFma,
  181. _FpCodeFmaSingle,
  182. _FpCodeFmaDouble,
  183. _FpCodeFms,
  184. _FpCodeFmsSingle,
  185. _FpCodeFmsDouble,
  186. _FpCodeFnma,
  187. _FpCodeFnmaSingle,
  188. _FpCodeFnmaDouble,
  189. _FpCodeFamin,
  190. _FpCodeFamax
  191. #endif
  192. } _FP_OPERATION_CODE;
  193. #endif /* #ifndef __assembler */
  194. /*
  195. * Define rounding modes.
  196. */
  197. #ifndef __assembler /* MIPS ONLY: Protect from assembler */
  198. typedef enum {
  199. _FpRoundNearest,
  200. _FpRoundMinusInfinity,
  201. _FpRoundPlusInfinity,
  202. _FpRoundChopped
  203. } _FPIEEE_ROUNDING_MODE;
  204. typedef enum {
  205. _FpPrecisionFull,
  206. _FpPrecision53,
  207. _FpPrecision24,
  208. #if defined(_M_IA64)
  209. _FpPrecision64,
  210. _FpPrecision113
  211. #endif
  212. } _FPIEEE_PRECISION;
  213. /*
  214. * Define floating point context record
  215. */
  216. typedef float _FP32;
  217. typedef double _FP64;
  218. typedef short _I16;
  219. typedef int _I32;
  220. typedef unsigned short _U16;
  221. typedef unsigned int _U32;
  222. typedef __int64 _Q64;
  223. typedef struct
  224. #if defined(_M_IA64)
  225. __declspec(align(16))
  226. #endif
  227. {
  228. unsigned short W[5];
  229. } _FP80;
  230. typedef struct __declspec(align(16))
  231. {
  232. unsigned long W[4];
  233. } _FP128;
  234. typedef struct __declspec(align(8))
  235. {
  236. unsigned long W[2];
  237. } _I64;
  238. typedef struct __declspec(align(8))
  239. {
  240. unsigned long W[2];
  241. } _U64;
  242. typedef struct
  243. #if defined(_M_IA64)
  244. __declspec(align(16))
  245. #endif
  246. {
  247. unsigned short W[5];
  248. } _BCD80;
  249. typedef struct __declspec(align(16))
  250. {
  251. _Q64 W[2];
  252. } _FPQ64;
  253. typedef struct {
  254. union {
  255. _FP32 Fp32Value;
  256. _FP64 Fp64Value;
  257. _FP80 Fp80Value;
  258. _FP128 Fp128Value;
  259. _I16 I16Value;
  260. _I32 I32Value;
  261. _I64 I64Value;
  262. _U16 U16Value;
  263. _U32 U32Value;
  264. _U64 U64Value;
  265. _BCD80 Bcd80Value;
  266. char *StringValue;
  267. int CompareValue;
  268. _Q64 Q64Value;
  269. _FPQ64 Fpq64Value;
  270. } Value;
  271. unsigned int OperandValid : 1;
  272. unsigned int Format : 4;
  273. } _FPIEEE_VALUE;
  274. typedef struct {
  275. unsigned int Inexact : 1;
  276. unsigned int Underflow : 1;
  277. unsigned int Overflow : 1;
  278. unsigned int ZeroDivide : 1;
  279. unsigned int InvalidOperation : 1;
  280. } _FPIEEE_EXCEPTION_FLAGS;
  281. typedef struct {
  282. unsigned int RoundingMode : 2;
  283. unsigned int Precision : 3;
  284. unsigned int Operation :12;
  285. _FPIEEE_EXCEPTION_FLAGS Cause;
  286. _FPIEEE_EXCEPTION_FLAGS Enable;
  287. _FPIEEE_EXCEPTION_FLAGS Status;
  288. _FPIEEE_VALUE Operand1;
  289. _FPIEEE_VALUE Operand2;
  290. _FPIEEE_VALUE Result;
  291. #if defined(_M_IA64)
  292. _FPIEEE_VALUE Operand3;
  293. #endif
  294. } _FPIEEE_RECORD, *_PFPIEEE_RECORD;
  295. struct _EXCEPTION_POINTERS;
  296. /*
  297. * Floating point IEEE exception filter routine
  298. */
  299. _CRTIMP int __cdecl _fpieee_flt(
  300. unsigned long,
  301. struct _EXCEPTION_POINTERS *,
  302. int (__cdecl *)(_FPIEEE_RECORD *)
  303. );
  304. #ifdef __cplusplus
  305. }
  306. #endif
  307. #ifdef _MSC_VER
  308. #pragma warning(pop)
  309. #pragma pack(pop)
  310. #endif /* _MSC_VER */
  311. #endif /* #ifndef __assembler */
  312. #endif /* _INC_FPIEEE */