[Misc] Replaced const with constexpr where possible

This commit is contained in:
Xphalnos
2025-04-04 22:36:05 +02:00
committed by Radosław Gliński
parent c4f1bf27ef
commit 47f327e848
42 changed files with 154 additions and 152 deletions

View File

@@ -51,7 +51,7 @@ struct X_ACHIEVEMENT_DETAILS {
X_FILETIME unlock_time;
xe::be<uint32_t> flags;
static const size_t kStringBufferSize = 464;
static constexpr size_t kStringBufferSize = 464;
};
static_assert_size(X_ACHIEVEMENT_DETAILS, 36);

View File

@@ -32,13 +32,13 @@ namespace xam {
// will not be recognized properly.
#define ONE_GB (1024ull * 1024ull * 1024ull)
static const DummyDeviceInfo dummy_hdd_device_info_ = {
static constexpr DummyDeviceInfo dummy_hdd_device_info_ = {
DummyDeviceId::HDD, DeviceType::HDD,
20ull * ONE_GB, // 20GB
3ull * ONE_GB, // 3GB, so it looks a little used.
u"Dummy HDD",
};
static const DummyDeviceInfo dummy_odd_device_info_ = {
static constexpr DummyDeviceInfo dummy_odd_device_info_ = {
DummyDeviceId::ODD, DeviceType::ODD,
7ull * ONE_GB, // 7GB (rough maximum)
0ull * ONE_GB, // read-only FS, so no free space

View File

@@ -550,11 +550,11 @@ DECLARE_XAM_EXPORT1(NetDll_XNetSetSystemLinkPort, kNetworking, kStub);
// https://github.com/ILOVEPIE/Cxbx-Reloaded/blob/master/src/CxbxKrnl/EmuXOnline.h#L39
struct XEthernetStatus {
static const uint32_t XNET_ETHERNET_LINK_ACTIVE = 0x01;
static const uint32_t XNET_ETHERNET_LINK_100MBPS = 0x02;
static const uint32_t XNET_ETHERNET_LINK_10MBPS = 0x04;
static const uint32_t XNET_ETHERNET_LINK_FULL_DUPLEX = 0x08;
static const uint32_t XNET_ETHERNET_LINK_HALF_DUPLEX = 0x10;
static constexpr uint32_t XNET_ETHERNET_LINK_ACTIVE = 0x01;
static constexpr uint32_t XNET_ETHERNET_LINK_100MBPS = 0x02;
static constexpr uint32_t XNET_ETHERNET_LINK_10MBPS = 0x04;
static constexpr uint32_t XNET_ETHERNET_LINK_FULL_DUPLEX = 0x08;
static constexpr uint32_t XNET_ETHERNET_LINK_HALF_DUPLEX = 0x10;
};
dword_result_t NetDll_XNetGetEthernetLinkStatus_entry(dword_t caller) {

View File

@@ -1554,7 +1554,7 @@ bool xeDrawProfileContent(ui::ImGuiDrawer* imgui_drawer, const uint64_t xuid,
uint64_t* selected_xuid) {
auto profile_manager = kernel_state()->xam_state()->profile_manager();
const float default_image_size = 75.0f;
constexpr float default_image_size = 75.0f;
const ImVec2 next_window_position =
ImVec2(ImGui::GetWindowPos().x + ImGui::GetWindowSize().x + 20.f,
ImGui::GetWindowPos().y);

View File

@@ -39,7 +39,7 @@ class XIOCompletion : public XObject {
bool WaitForNotification(uint64_t wait_ticks, IONotification* notify);
private:
static const uint32_t kMaxNotifications = 1024;
static constexpr uint32_t kMaxNotifications = 1024;
std::mutex notification_lock_;
std::queue<IONotification> notifications_;

View File

@@ -307,7 +307,7 @@ X_STATUS XThread::Create() {
module->GetOptHeader(XEX_HEADER_TLS_INFO, &tls_header);
}
const uint32_t kDefaultTlsSlotCount = 1024;
constexpr uint32_t kDefaultTlsSlotCount = 1024;
uint32_t tls_slots = kDefaultTlsSlotCount;
uint32_t tls_extended_size = 0;
if (tls_header && tls_header->slot_count) {