mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 03:58:07 +02:00
avoid branching by using %= operator
This commit is contained in:
parent
6756d5364b
commit
8454cb916c
1 changed files with 2 additions and 6 deletions
|
@ -102,9 +102,7 @@ void PacketTimeWindow::onPacketArrival() {
|
||||||
_packetIntervals[_currentPacketInterval++] = duration_cast<microseconds>(now - _lastPacketTime).count();
|
_packetIntervals[_currentPacketInterval++] = duration_cast<microseconds>(now - _lastPacketTime).count();
|
||||||
|
|
||||||
// reset the currentPacketInterval index when it wraps
|
// reset the currentPacketInterval index when it wraps
|
||||||
if (_currentPacketInterval == _numPacketIntervals) {
|
_currentPacketInterval %= _numPacketIntervals;
|
||||||
_currentPacketInterval = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remember this as the last packet arrival time
|
// remember this as the last packet arrival time
|
||||||
|
@ -123,7 +121,5 @@ void PacketTimeWindow::onProbePair2Arrival() {
|
||||||
_probeIntervals[_currentProbeInterval++] = duration_cast<microseconds>(now - _firstProbeTime).count();
|
_probeIntervals[_currentProbeInterval++] = duration_cast<microseconds>(now - _firstProbeTime).count();
|
||||||
|
|
||||||
// reset the currentProbeInterval index when it wraps
|
// reset the currentProbeInterval index when it wraps
|
||||||
if (_currentProbeInterval == _numProbeIntervals) {
|
_currentProbeInterval %= _numProbeIntervals;
|
||||||
_currentProbeInterval = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue