From e9f218d52e10db4034bb8c70db4168a83eb9f779 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sun, 9 Nov 2025 00:01:23 -0500 Subject: [PATCH] refactor: move control bit masks to anonymous namespace for better encapsulation --- src/NLPacketCodec.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/NLPacketCodec.cpp b/src/NLPacketCodec.cpp index 96ab6e6..85efa6a 100644 --- a/src/NLPacketCodec.cpp +++ b/src/NLPacketCodec.cpp @@ -12,12 +12,16 @@ namespace Overte { +namespace { + // Control bit masks for sequence number field -static constexpr uint32_t CONTROL_BIT_MASK = 0x80000000; // Bit 31 -static constexpr uint32_t RELIABLE_BIT_MASK = 0x40000000; // Bit 30 -static constexpr uint32_t MESSAGE_BIT_MASK = 0x20000000; // Bit 29 -static constexpr uint32_t OBFUSCATION_MASK = 0x18000000; // Bits 27-28 -static constexpr uint32_t SEQUENCE_NUMBER_MASK = 0x07FFFFFF; // Bits 0-26 +constexpr uint32_t CONTROL_BIT_MASK = 0x80000000; // Bit 31 +constexpr uint32_t RELIABLE_BIT_MASK = 0x40000000; // Bit 30 +constexpr uint32_t MESSAGE_BIT_MASK = 0x20000000; // Bit 29 +constexpr uint32_t OBFUSCATION_MASK = 0x18000000; // Bits 27-28 +constexpr uint32_t SEQUENCE_NUMBER_MASK = 0x07FFFFFF; // Bits 0-26 + +} // anonymous namespace NLPacket::NLPacket(PacketType type, PacketVersion version, bool isReliable) : m_type(type)