From d8f4c8bc7e9b5d104d7af78e7439974b38041272 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 14 Sep 2024 00:58:37 +0200 Subject: [PATCH] Don't perform arithmetic on enum values. --- profiler/src/profiler/TracySourceView.hpp | 10 +++++----- profiler/src/profiler/TracyView_Memory.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/profiler/src/profiler/TracySourceView.hpp b/profiler/src/profiler/TracySourceView.hpp index d317b8ac..f36daaae 100644 --- a/profiler/src/profiler/TracySourceView.hpp +++ b/profiler/src/profiler/TracySourceView.hpp @@ -72,11 +72,11 @@ private: rd }; - enum { ReadBit = 0x100 }; - enum { WriteBit = 0x200 }; - enum { ReuseBit = 0x400 }; - enum { RegMask = 0x0FF }; - enum { FlagMask = 0xF00 }; + static constexpr int ReadBit = 0x100; + static constexpr int WriteBit = 0x200; + static constexpr int ReuseBit = 0x400; + static constexpr int RegMask = 0x0FF; + static constexpr int FlagMask = 0xF00; enum class OpType : uint8_t { diff --git a/profiler/src/profiler/TracyView_Memory.cpp b/profiler/src/profiler/TracyView_Memory.cpp index f058e920..4652eb25 100644 --- a/profiler/src/profiler/TracyView_Memory.cpp +++ b/profiler/src/profiler/TracyView_Memory.cpp @@ -8,11 +8,11 @@ namespace tracy { -enum { ChunkBits = 10 }; -enum { PageBits = 10 }; -enum { PageSize = 1 << PageBits }; -enum { PageChunkBits = ChunkBits + PageBits }; -enum { PageChunkSize = 1 << PageChunkBits }; +constexpr size_t ChunkBits = 10; +constexpr size_t PageBits = 10; +constexpr size_t PageSize = 1 << PageBits; +constexpr size_t PageChunkBits = ChunkBits + PageBits; +constexpr size_t PageChunkSize = 1 << PageChunkBits; uint32_t MemDecayColor[256] = { 0x0, 0xFF077F07, 0xFF078007, 0xFF078207, 0xFF078307, 0xFF078507, 0xFF078707, 0xFF078807,