From c3e4341a044d96d4f67dd923fce49a9695e9a681 Mon Sep 17 00:00:00 2001 From: Vyacheslav Ivanov Date: Fri, 2 Aug 2024 06:12:30 +0300 Subject: [PATCH] fix: optimization: PVS-Studio warning V802 Rearranged structure fields in decreasing order of size to reduce structure size from 32 to 24 and 12 to 8 bytes on 64-bit platforms. Reported by: PVS-Studio Signed-off-by: Vyacheslav Ivanov --- src/items/ItemDef.hpp | 2 +- src/util/command_line.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/items/ItemDef.hpp b/src/items/ItemDef.hpp index 12100fb3..319860e1 100644 --- a/src/items/ItemDef.hpp +++ b/src/items/ItemDef.hpp @@ -38,8 +38,8 @@ struct ItemDef { struct { itemid_t id; - item_funcs_set funcsset {}; blockid_t placingBlock; + item_funcs_set funcsset {}; bool emissive = false; } rt {}; diff --git a/src/util/command_line.cpp b/src/util/command_line.cpp index 16fbdade..16178662 100644 --- a/src/util/command_line.cpp +++ b/src/util/command_line.cpp @@ -11,12 +11,12 @@ namespace fs = std::filesystem; class ArgsReader { - int argc; - char** argv; - int pos = 0; const char* last = ""; + char** argv; + int argc; + int pos = 0; public: - ArgsReader(int argc, char** argv) : argc(argc), argv(argv) {} + ArgsReader(int argc, char** argv) : argv(argv), argc(argc) {} void skip() { pos++;