summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorShawn Hoffman <godisgovernment@gmail.com>2020-08-17 17:30:49 -0700
committerShawn Hoffman <godisgovernment@gmail.com>2020-08-23 13:57:05 -0700
commit938fd4e43871d281f5efa185a5b62b8b74fa13f3 (patch)
treeb0c89093566977129d30191877893cb8649cc897 /Source
parent79f5ea04744a50c006067800d506211553757387 (diff)
use constexpr for some compile-time expressions
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp2
-rw-r--r--Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp4
-rw-r--r--Source/Core/VideoBackends/D3D12/VertexManager.cpp4
3 files changed, 5 insertions, 5 deletions
diff --git a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp
index b8513df344..661398b351 100644
--- a/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp
+++ b/Source/Core/Core/IOS/USB/USB_HID/HIDv4.cpp
@@ -208,7 +208,7 @@ static void CopyDescriptorToBuffer(std::vector<u8>* buffer, T descriptor)
descriptor.Swap();
buffer->insert(buffer->end(), reinterpret_cast<const u8*>(&descriptor),
reinterpret_cast<const u8*>(&descriptor) + size);
- const size_t number_of_padding_bytes = Common::AlignUp(size, 4) - size;
+ constexpr size_t number_of_padding_bytes = Common::AlignUp(size, 4) - size;
buffer->insert(buffer->end(), number_of_padding_bytes, 0);
}
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
index a81fae3dc1..5d1a6ed21d 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
@@ -61,8 +61,8 @@ template <typename SType>
SType ScaleAndClamp(double ps, u32 stScale)
{
float convPS = (float)ps * m_quantizeTable[stScale];
- float min = (float)std::numeric_limits<SType>::min();
- float max = (float)std::numeric_limits<SType>::max();
+ constexpr float min = (float)std::numeric_limits<SType>::min();
+ constexpr float max = (float)std::numeric_limits<SType>::max();
return (SType)std::clamp(convPS, min, max);
}
diff --git a/Source/Core/VideoBackends/D3D12/VertexManager.cpp b/Source/Core/VideoBackends/D3D12/VertexManager.cpp
index bdf5fbe8e8..ecaec7c9c1 100644
--- a/Source/Core/VideoBackends/D3D12/VertexManager.cpp
+++ b/Source/Core/VideoBackends/D3D12/VertexManager.cpp
@@ -195,10 +195,10 @@ void VertexManager::UploadAllConstants()
{
// We are free to re-use parts of the buffer now since we're uploading all constants.
const u32 pixel_constants_offset = 0;
- const u32 vertex_constants_offset =
+ constexpr u32 vertex_constants_offset =
Common::AlignUp(pixel_constants_offset + sizeof(PixelShaderConstants),
D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT);
- const u32 geometry_constants_offset =
+ constexpr u32 geometry_constants_offset =
Common::AlignUp(vertex_constants_offset + sizeof(VertexShaderConstants),
D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT);
const u32 allocation_size = geometry_constants_offset + sizeof(GeometryShaderConstants);