00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef INCLUDED_SAL_MATHCONF_H
00021 #define INCLUDED_SAL_MATHCONF_H
00022
00023 #include "osl/endian.h"
00024
00025 #include <float.h>
00026
00027 #if defined SOLARIS
00028 #include <ieeefp.h>
00029 #endif
00030
00031 #if defined(__cplusplus) && ( defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L )
00032 #include <cmath>
00033 #endif
00034
00035 #if defined(IOS)
00036 #if defined(__cplusplus)
00037 #include <cmath>
00038 #else
00039 #include <math.h>
00040 #endif
00041 #endif
00042
00043 #if defined __cplusplus
00044 extern "C" {
00045 #endif
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #if defined WNT
00058 #define SAL_MATH_FPEXCEPTIONS_OFF() _control87( _MCW_EM, _MCW_EM )
00059 #else
00060 #define SAL_MATH_FPEXCEPTIONS_OFF()
00061 #endif
00062
00063
00064
00065 #if !defined SOLARIS && !defined ANDROID \
00066 && defined(__cplusplus) \
00067 && ( defined(__GXX_EXPERIMENTAL_CXX0X__) \
00068 || __cplusplus >= 201103L \
00069 || defined(IOS) )
00070 #define SAL_MATH_FINITE(d) std::isfinite(d)
00071 #elif defined( IOS )
00072 #define SAL_MATH_FINITE(d) isfinite(d)
00073 #elif defined( WNT)
00074 #define SAL_MATH_FINITE(d) _finite(d)
00075 #elif defined LINUX || defined UNX
00076 #define SAL_MATH_FINITE(d) finite(d)
00077 #else
00078 #error "SAL_MATH_FINITE not defined"
00079 #endif
00080
00081
00082
00083 #if 1
00084 #if defined OSL_BIGENDIAN
00085
00086
00087 union sal_math_Double
00088 {
00089 struct
00090 {
00091 unsigned sign : 1;
00092 unsigned exponent :11;
00093 unsigned fraction_hi :20;
00094 unsigned fraction_lo :32;
00095 } inf_parts;
00096 struct
00097 {
00098 unsigned sign : 1;
00099 unsigned exponent :11;
00100 unsigned qnan_bit : 1;
00101 unsigned bits :19;
00102 unsigned fraction_lo :32;
00103 } nan_parts;
00104 struct
00105 {
00106 unsigned msw :32;
00107 unsigned lsw :32;
00108 } w32_parts;
00109 double value;
00110 };
00111
00112 #elif defined OSL_LITENDIAN
00113
00114
00115 union sal_math_Double
00116 {
00117 struct {
00118 unsigned fraction_lo :32;
00119 unsigned fraction_hi :20;
00120 unsigned exponent :11;
00121 unsigned sign : 1;
00122 } inf_parts;
00123 struct {
00124 unsigned fraction_lo :32;
00125 unsigned bits :19;
00126 unsigned qnan_bit : 1;
00127 unsigned exponent :11;
00128 unsigned sign : 1;
00129 } nan_parts;
00130 struct
00131 {
00132 unsigned lsw :32;
00133 unsigned msw :32;
00134 } w32_parts;
00135 double value;
00136 };
00137
00138 #else
00139
00140 #error "neither OSL_BIGENDIAN nor OSL_LITENDIAN"
00141
00142 #endif
00143 #else
00144
00145 #error "don't know how to handle IEEE 754"
00146
00147 #endif
00148
00149
00150 #if defined __cplusplus
00151 }
00152 #endif
00153
00154 #endif
00155
00156