MCPcopy Create free account
hub / github.com/catboost/catboost / SumWithSaturation

Function SumWithSaturation

util/datetime/base.h:677–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

675namespace NDateTimeHelpers {
676 template <typename T>
677 static constexpr T SumWithSaturation(T a, T b) {
678 static_assert(!std::numeric_limits<T>::is_signed, "expect !std::numeric_limits<T>::is_signed");
679
680 return Max<T>() - a < b ? Max<T>() : a + b;
681 }
682
683 template <typename T>
684 static constexpr T DiffWithSaturation(T a, T b) {

Callers 1

operator+Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected