Overflow Counter#
Defined in namespace hal
#include <libhal-util/overflow_counter.hpp>
- group OverflowCounter
Functions
-
inline constexpr uint64_t update(uint32_t p_new_count)#
update the overflow counter, detect if an overflow has occurred, and return the combined
- Parameters:
p_new_count β - must be an increasing value and should only decrease when an overflow event occurs.
- Returns:
constexpr uint64_t - 64-bit count combining the new count value and the overflow count value.
-
inline constexpr void reset()#
Reset the overflow count back to zero.
-
template<size_t count_bit_width = 32>
class overflow_counter# - #include <overflow_counter.hpp>
Extend a counterβs count from an arbitrary bit width to 64-bits by detecting overflows in the count. Each detected overflow is added to an overflow counter which is combined with the current count in order create a count up to 64-bits in length.
- Template Parameters:
count_bit_width β - the bit width of the counter before the count value overflows.
Public Functions
-
inline constexpr uint64_t update(uint32_t p_new_count)#
update the overflow counter, detect if an overflow has occurred, and return the combined
- Parameters:
p_new_count β - must be an increasing value and should only decrease when an overflow event occurs.
- Returns:
constexpr uint64_t - 64-bit count combining the new count value and the overflow count value.
-
inline constexpr void reset()#
Reset the overflow count back to zero.
-
inline constexpr uint64_t update(uint32_t p_new_count)#