Distinguish unsigned-counter rollover from reset before using a decrease to calculate production increments.
Keep the counter width
RFC 1982 defines finite serial-number arithmetic using a specified bit width and bounded increments. Ordinary numerical ordering can misdescribe a wrap. Primary reference: finite sequence arithmetic.
The reference concerns serial numbers, not a specification for an HM production counter. A proposed equipment counter must independently document its width, increment and reset behavior before any modular calculation is applicable.
A hypothetical sixteen-bit wrap
Assume an invented unsigned 16-bit counter increments normally, has not reset, and advances fewer than 32768 counts between observations. From 65530 to 4, the modular difference is(4−65530) modulo 65536, or 10. Reading the decrease as a negative production increment would ignore the stated wrap.
Those assumptions are essential. A reset or enough unobserved activity to violate the bounded interval could produce the same endpoint pair with another meaning. Two readings alone cannot settle that ambiguity. Record the last value, new value, bit width, interval and reset evidence beside the result.
Define the counter contract
Ask the supplier which events advance the counter, what survives restart and how reset or epoch changes are represented. Keep counter identity and its reset history with totals. A modulo formula does not reconstruct activity across an unknown number of complete wraps.
This guide provides no reset or control instruction and asserts no actual HM counter behavior. Its output is a conditional increment calculation and a list of the evidence required to trust it, allowing the consumer to preserve unresolved intervals instead of turning every decrease into either a fault or a proven rollover.
Customer Questions
Does a decrease prove rollover?
Reset and missing activity remain possible.
What is the stated example increment?
Ten under the explicit assumptions.
Can modulo reconstruct unlimited missed wraps?
Two endpoints are insufficient.
Primary References
These references support the technical principles discussed in this guide. The worked examples and review questions are educational.
Discuss Your Machine Requirement
Share your product, container, required output and the evidence needed for your technical review.
Request a Technical Review