MCPcopy Create free account
hub / github.com/VCVRack/Rack / clamp

Function clamp

include/math.hpp:32–34  ·  view source on GitHub ↗

Limits `x` between `a` and `b`. If `b < a`, returns a. */

Source from the content-addressed store, hash-verified

30If `b < a`, returns a.
31*/
32inline int clamp(int x, int a, int b) {
33 return std::max(std::min(x, b), a);
34}
35
36/** Limits `x` between `a` and `b`.
37If `b < a`, switches the two values.

Callers 6

clampiFunction · 0.70
clampfFunction · 0.70
colorClipFunction · 0.70
clampSafeFunction · 0.70
clampMethod · 0.70
clampMethod · 0.70

Calls 4

maxFunction · 0.85
minFunction · 0.85
fmaxFunction · 0.85
fminFunction · 0.85

Tested by

no test coverage detected