[Misc] Replaced const with constexpr where possible

This commit is contained in:
Xphalnos
2025-03-20 21:16:32 +01:00
committed by Radosław Gliński
parent d20620eb5e
commit 5f918ef28d
64 changed files with 191 additions and 190 deletions

View File

@@ -19,7 +19,7 @@ namespace vfs {
using namespace xe::literals;
const size_t kXESectorSize = 2_KiB;
constexpr size_t kXESectorSize = 2_KiB;
DiscImageDevice::DiscImageDevice(const std::string_view mount_path,
const std::filesystem::path& host_path)
@@ -70,7 +70,7 @@ Entry* DiscImageDevice::ResolvePath(const std::string_view path) {
DiscImageDevice::Error DiscImageDevice::Verify(ParseState* state) {
// Find sector 32 of the game partition - try at a few points.
static const size_t likely_offsets[] = {
static constexpr size_t likely_offsets[] = {
0x00000000, 0x0000FB20, 0x00020600, 0x02080000, 0x0FD90000,
};
bool magic_found = false;

View File

@@ -278,12 +278,12 @@ static_assert_size(XContentAttributes, 1);
#pragma pack(push, 1)
struct XContentMetadata {
static const uint32_t kThumbLengthV1 = 0x4000;
static const uint32_t kThumbLengthV2 = 0x3D00;
static constexpr uint32_t kThumbLengthV1 = 0x4000;
static constexpr uint32_t kThumbLengthV2 = 0x3D00;
static const uint32_t kNumLanguagesV1 = 9;
static constexpr uint32_t kNumLanguagesV1 = 9;
// metadata_version 2 adds 3 languages inside thumbnail/title_thumbnail space
static const uint32_t kNumLanguagesV2 = 12;
static constexpr uint32_t kNumLanguagesV2 = 12;
be<XContentType> content_type;
be<uint32_t> metadata_version;

View File

@@ -29,7 +29,7 @@ constexpr fourcc_t kPIRSSignature = make_fourcc("PIRS");
class XContentContainerDevice : public Device {
public:
const static uint32_t kBlockSize = 0x1000;
constexpr static uint32_t kBlockSize = 0x1000;
static std::unique_ptr<Device> CreateContentDevice(
const std::string_view mount_path,

View File

@@ -212,7 +212,7 @@ SvodContainerDevice::Result SvodContainerDevice::ReadEntry(
size_t last_record = -1;
size_t last_offset = -1;
while (remaining_size) {
const size_t BLOCK_SIZE = 0x800;
constexpr size_t BLOCK_SIZE = 0x800;
size_t offset, file_index;
BlockToOffset(block_index, &offset, &file_index);
@@ -370,12 +370,12 @@ void SvodContainerDevice::BlockToOffset(size_t block, size_t* out_address,
// consisting of 0x14388 data blocks, 0xCB Level0 hash tables, and 0x1
// Level1 hash table.
const size_t BLOCK_SIZE = 0x800;
const size_t HASH_BLOCK_SIZE = 0x1000;
const size_t BLOCKS_PER_L0_HASH = 0x198;
const size_t HASHES_PER_L1_HASH = 0xA1C4;
const size_t BLOCKS_PER_FILE = 0x14388;
const size_t MAX_FILE_SIZE = 0xA290000;
constexpr size_t BLOCK_SIZE = 0x800;
constexpr size_t HASH_BLOCK_SIZE = 0x1000;
constexpr size_t BLOCKS_PER_L0_HASH = 0x198;
constexpr size_t HASHES_PER_L1_HASH = 0xA1C4;
constexpr size_t BLOCKS_PER_FILE = 0x14388;
constexpr size_t MAX_FILE_SIZE = 0xA290000;
const size_t BLOCK_OFFSET =
header_->content_metadata.volume_descriptor.svod.start_data_block();