MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / CLIP

Function CLIP

Source/Amiga/paula.cpp:105–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103#define DENORMAL_OFFSET (1E-10)
104
105template<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:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected