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.

257 lines
4.3 KiB

  1. /***
  2. *fpieee.h - Definitions for floating point IEEE exception handling
  3. *
  4. * Copyright (c) 1991-1994, 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. ****/
  11. #ifndef _INC_FPIEEE
  12. #define _INC_FPIEEE
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  17. #ifndef _CRTAPI1
  18. #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
  19. #define _CRTAPI1 __cdecl
  20. #else
  21. #define _CRTAPI1
  22. #endif
  23. #endif
  24. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  25. #ifndef _CRTAPI2
  26. #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
  27. #define _CRTAPI2 __cdecl
  28. #else
  29. #define _CRTAPI2
  30. #endif
  31. #endif
  32. /* Define _CRTIMP */
  33. #ifndef _CRTIMP
  34. #ifdef _NTSDK
  35. /* definition compatible with NT SDK */
  36. #define _CRTIMP
  37. #else /* ndef _NTSDK */
  38. /* current definition */
  39. #ifdef _DLL
  40. #define _CRTIMP __declspec(dllimport)
  41. #else /* ndef _DLL */
  42. #define _CRTIMP
  43. #endif /* _DLL */
  44. #endif /* _NTSDK */
  45. #endif /* _CRTIMP */
  46. /* Define __cdecl for non-Microsoft compilers */
  47. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  48. #define __cdecl
  49. #endif
  50. /*
  51. * Define floating point IEEE compare result values.
  52. */
  53. typedef enum {
  54. _FpCompareEqual,
  55. _FpCompareGreater,
  56. _FpCompareLess,
  57. _FpCompareUnordered
  58. } _FPIEEE_COMPARE_RESULT;
  59. /*
  60. * Define floating point format and result precision values.
  61. */
  62. typedef enum {
  63. _FpFormatFp32,
  64. _FpFormatFp64,
  65. _FpFormatFp80,
  66. _FpFormatFp128,
  67. _FpFormatI16,
  68. _FpFormatI32,
  69. _FpFormatI64,
  70. _FpFormatU16,
  71. _FpFormatU32,
  72. _FpFormatU64,
  73. _FpFormatBcd80,
  74. _FpFormatCompare,
  75. _FpFormatString
  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. } _FP_OPERATION_CODE;
  122. /*
  123. * Define rounding modes.
  124. */
  125. typedef enum {
  126. _FpRoundNearest,
  127. _FpRoundMinusInfinity,
  128. _FpRoundPlusInfinity,
  129. _FpRoundChopped
  130. } _FPIEEE_ROUNDING_MODE;
  131. typedef enum {
  132. _FpPrecisionFull,
  133. _FpPrecision53,
  134. _FpPrecision24
  135. } _FPIEEE_PRECISION;
  136. /*
  137. * Define floating point context record
  138. */
  139. typedef float _FP32;
  140. typedef double _FP64;
  141. typedef short _I16;
  142. typedef int _I32;
  143. typedef unsigned short _U16;
  144. typedef unsigned int _U32;
  145. typedef struct {
  146. unsigned short W[5];
  147. } _FP80;
  148. typedef struct {
  149. unsigned long W[4];
  150. } _FP128;
  151. typedef struct {
  152. unsigned long W[2];
  153. } _I64;
  154. typedef struct {
  155. unsigned long W[2];
  156. } _U64;
  157. typedef struct {
  158. unsigned short W[5];
  159. } _BCD80;
  160. typedef struct {
  161. union {
  162. _FP32 Fp32Value;
  163. _FP64 Fp64Value;
  164. _FP80 Fp80Value;
  165. _FP128 Fp128Value;
  166. _I16 I16Value;
  167. _I32 I32Value;
  168. _I64 I64Value;
  169. _U16 U16Value;
  170. _U32 U32Value;
  171. _U64 U64Value;
  172. _BCD80 Bcd80Value;
  173. char *StringValue;
  174. int CompareValue;
  175. } Value;
  176. unsigned int OperandValid : 1;
  177. unsigned int Format : 4;
  178. } _FPIEEE_VALUE;
  179. typedef struct {
  180. unsigned int Inexact : 1;
  181. unsigned int Underflow : 1;
  182. unsigned int Overflow : 1;
  183. unsigned int ZeroDivide : 1;
  184. unsigned int InvalidOperation : 1;
  185. } _FPIEEE_EXCEPTION_FLAGS;
  186. typedef struct {
  187. unsigned int RoundingMode : 2;
  188. unsigned int Precision : 3;
  189. unsigned int Operation :12;
  190. _FPIEEE_EXCEPTION_FLAGS Cause;
  191. _FPIEEE_EXCEPTION_FLAGS Enable;
  192. _FPIEEE_EXCEPTION_FLAGS Status;
  193. _FPIEEE_VALUE Operand1;
  194. _FPIEEE_VALUE Operand2;
  195. _FPIEEE_VALUE Result;
  196. } _FPIEEE_RECORD;
  197. struct _EXCEPTION_POINTERS;
  198. /*
  199. * Floating point IEEE exception filter routine
  200. */
  201. _CRTIMP int __cdecl _fpieee_flt(
  202. unsigned long,
  203. struct _EXCEPTION_POINTERS *,
  204. int (__cdecl *)(_FPIEEE_RECORD *)
  205. );
  206. #ifdef __cplusplus
  207. }
  208. #endif
  209. #endif /* _INC_FPIEEE */