CIntElement: Make use of std::clamp within CIEClamp's overrides

Same behavior, less code.
This commit is contained in:
Lioncash 2019-10-04 19:50:54 -04:00
parent 3407a59ad7
commit ff940612bc
1 changed files with 4 additions and 13 deletions

View File

@ -72,26 +72,17 @@ bool CIEClamp::GetValue(int frame, int& valOut) const {
x4_min->GetValue(frame, a); x4_min->GetValue(frame, a);
x8_max->GetValue(frame, b); x8_max->GetValue(frame, b);
xc_val->GetValue(frame, valOut); xc_val->GetValue(frame, valOut);
if (valOut > b)
valOut = b; valOut = std::clamp(valOut, a, b);
if (valOut < a)
valOut = a;
return false; return false;
} }
int CIEClamp::GetMaxValue() const { int CIEClamp::GetMaxValue() const {
const int a = x4_min->GetMaxValue(); const int a = x4_min->GetMaxValue();
const int b = x8_max->GetMaxValue(); const int b = x8_max->GetMaxValue();
int valOut = xc_val->GetMaxValue(); const int valOut = xc_val->GetMaxValue();
if (valOut > b) { return std::clamp(valOut, a, b);
valOut = b;
}
if (valOut < a) {
valOut = a;
}
return valOut;
} }
bool CIETimeChain::GetValue(int frame, int& valOut) const { bool CIETimeChain::GetValue(int frame, int& valOut) const {