Use range map in RTPMunger. (#2000)

* WIP commit

* Make lastSN 32-bit

* Remove unused TSCycles
This commit is contained in:
Raja Subramanian
2023-08-27 10:49:17 +05:30
committed by GitHub
parent 3c31ae5dc0
commit 55d5edcf73
9 changed files with 229 additions and 196 deletions
+10 -1
View File
@@ -59,12 +59,21 @@ func NewRangeMap[RT rangeType, VT valueType](size int) *RangeMap[RT, VT] {
}
}
func (r *RangeMap[RT, VT]) ClearAndResetValue(val VT) {
r.ranges = r.ranges[:0]
r.runningValue = val
}
func (r *RangeMap[RT, VT]) IncValue(inc VT) {
r.runningValue += inc
}
func (r *RangeMap[RT, VT]) DecValue(dec VT) {
r.runningValue -= dec
}
func (r *RangeMap[RT, VT]) AddRange(startInclusive RT, endExclusive RT) error {
if endExclusive-startInclusive > r.halfRange {
if endExclusive == startInclusive || endExclusive-startInclusive > r.halfRange {
return errReversedOrder
}