Skip to content

Commit f6c17a9

Browse files
committed
Use std::clamp
1 parent 3287eb5 commit f6c17a9

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

src/coreComponents/events/EventBase.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,7 @@ void EventBase::checkEvents( real64 const time,
186186
real64 constexpr min_ratio = static_cast< real64 >(LvArray::NumericLimits< integer >::min);
187187
real64 constexpr max_ratio = static_cast< real64 >(LvArray::NumericLimits< integer >::max);
188188

189-
real64 const ratio = ( m_beginTime - time ) / dt;
190-
191-
integer const forecast = ratio < min_ratio ? LvArray::NumericLimits< integer >::min :
192-
(ratio > max_ratio ? LvArray::NumericLimits< integer >::max :
193-
static_cast< integer >(ratio));
194-
this->setForecast( std::clamp( static_cast<integer>( (m_beginTime - time) / dt ), LvArray::NumericLimits< integer >::min, LvArray::NumericLimits< integer >::max );
189+
this->setForecast( static_cast< integer >(std::clamp(( m_beginTime - time ) / dt, min_ratio, max_ratio )) );
195190
}
196191
}
197192
else if( time >= m_endTime )

0 commit comments

Comments
 (0)