| 103 | #define DENORMAL_OFFSET (1E-10) |
| 104 | |
| 105 | template<typename T> inline T CLIP(T v, T amin, T amax) |
| 106 | { |
| 107 | #if !defined(RELEASE_BUILD) |
| 108 | // Debug builds use this assert to pinpoint |
| 109 | // any problematic cases, where amin and amax |
| 110 | // are incorrectly ordered |
| 111 | // and thus CLIP() would return an invalid result. |
| 112 | assert(amin <= amax); |
| 113 | #endif |
| 114 | if (v < amin) return amin; |
| 115 | else if (v > amax) return amax; |
| 116 | return v; |
| 117 | } |
| 118 | |
| 119 | /* Based on UAE. |
| 120 | * Original comment in UAE: |
nothing calls this directly
no outgoing calls
no test coverage detected