Source code of Windows XP (NT5)
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.

369 lines
6.7 KiB

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