MCPcopy Create free account
hub / github.com/KAlO2/PerfectShow / clamp

Function clamp

jni/venus/common.h:21–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 */
20template<typename T>
21inline T clamp(const T& value, const T& min, const T& max)
22{
23 assert(min <= max && "invalid clamp range");
24#if 0
25 return std::min<T>(std::max<T>(value, min), max);
26#else
27 if(value < min) return min;
28 if(value > max) return max;
29 return value;
30#endif
31}
32
33/*
34template<typename T>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected