Skip to content

Commit 95ec398

Browse files
lint
1 parent bb93e71 commit 95ec398

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/extension/network/PacketDeduplicator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace NUClear {
2525
namespace extension {
2626
namespace network {
2727

28-
PacketDeduplicator::PacketDeduplicator() : newest_seen(0) {}
28+
PacketDeduplicator::PacketDeduplicator() {}
2929

3030
bool PacketDeduplicator::is_duplicate(uint16_t packet_id) const {
3131
// If we haven't seen any packets yet, nothing is a duplicate
@@ -34,7 +34,7 @@ namespace extension {
3434
}
3535

3636
// Calculate relative position in window using unsigned subtraction
37-
uint16_t relative_id = newest_seen - packet_id;
37+
const uint16_t relative_id = newest_seen - packet_id;
3838

3939
// If the packet is too old or too new, it's not a duplicate
4040
if (relative_id >= 256) {
@@ -54,12 +54,12 @@ namespace extension {
5454
}
5555

5656
// Calculate relative position in window using unsigned subtraction
57-
uint16_t relative_id = newest_seen - packet_id;
57+
const uint16_t relative_id = newest_seen - packet_id;
5858

5959
// If the distance is more than half the range, the packet is newer than our newest_seen
6060
if (relative_id > 32768) {
6161
// Calculate how far to shift to make this packet our newest
62-
uint16_t shift_amount = packet_id - newest_seen;
62+
const uint16_t shift_amount = packet_id - newest_seen;
6363
window <<= shift_amount;
6464
newest_seen = packet_id;
6565
window[0] = true;

src/extension/network/PacketDeduplicator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace extension {
5757
/// Whether we've seen any packets yet
5858
bool initialized{false};
5959
/// The newest packet ID we've seen
60-
uint16_t newest_seen;
60+
uint16_t newest_seen{0};
6161
/// The 256-bit window of seen packets (newest at 0, older at higher indices)
6262
std::bitset<256> window;
6363
};

0 commit comments

Comments
 (0)