diff options
Diffstat (limited to 'src/base/sat_counter.hh')
-rw-r--r-- | src/base/sat_counter.hh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/base/sat_counter.hh b/src/base/sat_counter.hh index 3de9486db..6aeca681d 100644 --- a/src/base/sat_counter.hh +++ b/src/base/sat_counter.hh @@ -235,6 +235,18 @@ class SatCounter */ bool isSaturated() const { return counter == maxVal; } + /** + * Saturate the counter. + * + * @return The value added to the counter to reach saturation. + */ + uint8_t saturate() + { + const uint8_t diff = maxVal - counter; + counter = maxVal; + return diff; + } + private: uint8_t initialVal; uint8_t maxVal; |