| OLD | NEW |
| 1 /************************************************************************** | 1 /************************************************************************** |
| 2 * | 2 * |
| 3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. | 3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. |
| 4 * All Rights Reserved. | 4 * All Rights Reserved. |
| 5 * | 5 * |
| 6 * Permission is hereby granted, free of charge, to any person obtaining a | 6 * Permission is hereby granted, free of charge, to any person obtaining a |
| 7 * copy of this software and associated documentation files (the | 7 * copy of this software and associated documentation files (the |
| 8 * "Software"), to deal in the Software without restriction, including | 8 * "Software"), to deal in the Software without restriction, including |
| 9 * without limitation the rights to use, copy, modify, merge, publish, | 9 * without limitation the rights to use, copy, modify, merge, publish, |
| 10 * distribute, sub license, and/or sell copies of the Software, and to | 10 * distribute, sub license, and/or sell copies of the Software, and to |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 return (float) log( (double) f ); | 105 return (float) log( (double) f ); |
| 106 } | 106 } |
| 107 | 107 |
| 108 #else | 108 #else |
| 109 /* Work-around an extra semi-colon in VS 2005 logf definition */ | 109 /* Work-around an extra semi-colon in VS 2005 logf definition */ |
| 110 #ifdef logf | 110 #ifdef logf |
| 111 #undef logf | 111 #undef logf |
| 112 #define logf(x) ((float)log((double)(x))) | 112 #define logf(x) ((float)log((double)(x))) |
| 113 #endif /* logf */ | 113 #endif /* logf */ |
| 114 | 114 |
| 115 #if _MSC_VER < 1800 |
| 115 #define isfinite(x) _finite((double)(x)) | 116 #define isfinite(x) _finite((double)(x)) |
| 116 #define isnan(x) _isnan((double)(x)) | 117 #define isnan(x) _isnan((double)(x)) |
| 118 #endif /* _MSC_VER < 1800 */ |
| 117 #endif /* _MSC_VER < 1400 && !defined(__cplusplus) */ | 119 #endif /* _MSC_VER < 1400 && !defined(__cplusplus) */ |
| 118 | 120 |
| 121 #if _MSC_VER < 1800 |
| 119 static INLINE double log2( double x ) | 122 static INLINE double log2( double x ) |
| 120 { | 123 { |
| 121 const double invln2 = 1.442695041; | 124 const double invln2 = 1.442695041; |
| 122 return log( x ) * invln2; | 125 return log( x ) * invln2; |
| 123 } | 126 } |
| 124 | 127 |
| 125 static INLINE double | 128 static INLINE double |
| 126 round(double x) | 129 round(double x) |
| 127 { | 130 { |
| 128 return x >= 0.0 ? floor(x + 0.5) : ceil(x - 0.5); | 131 return x >= 0.0 ? floor(x + 0.5) : ceil(x - 0.5); |
| 129 } | 132 } |
| 130 | 133 |
| 131 static INLINE float | 134 static INLINE float |
| 132 roundf(float x) | 135 roundf(float x) |
| 133 { | 136 { |
| 134 return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f); | 137 return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f); |
| 135 } | 138 } |
| 139 #endif |
| 136 | 140 |
| 137 #endif /* _MSC_VER */ | 141 #endif /* _MSC_VER */ |
| 138 | 142 |
| 139 | 143 |
| 140 #ifdef PIPE_OS_ANDROID | 144 #ifdef PIPE_OS_ANDROID |
| 141 | 145 |
| 142 static INLINE | 146 static INLINE |
| 143 double log2(double d) | 147 double log2(double d) |
| 144 { | 148 { |
| 145 return log(d) * (1.0 / M_LN2); | 149 return log(d) * (1.0 / M_LN2); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 return (int32_t)(value * (1<<frac_bits)); | 765 return (int32_t)(value * (1<<frac_bits)); |
| 762 } | 766 } |
| 763 | 767 |
| 764 | 768 |
| 765 | 769 |
| 766 #ifdef __cplusplus | 770 #ifdef __cplusplus |
| 767 } | 771 } |
| 768 #endif | 772 #endif |
| 769 | 773 |
| 770 #endif /* U_MATH_H */ | 774 #endif /* U_MATH_H */ |
| OLD | NEW |