diff --git a/src/xenia/base/memory.h b/src/xenia/base/memory.h index 3819f9dbe..4188af763 100644 --- a/src/xenia/base/memory.h +++ b/src/xenia/base/memory.h @@ -295,49 +295,49 @@ inline std::wstring load_and_swap(const void* mem) { } template -void store(void* mem, T value); +void store(void* mem, const T& value); template <> -inline void store(void* mem, int8_t value) { +inline void store(void* mem, const int8_t& value) { *reinterpret_cast(mem) = value; } template <> -inline void store(void* mem, uint8_t value) { +inline void store(void* mem, const uint8_t& value) { *reinterpret_cast(mem) = value; } template <> -inline void store(void* mem, int16_t value) { +inline void store(void* mem, const int16_t& value) { *reinterpret_cast(mem) = value; } template <> -inline void store(void* mem, uint16_t value) { +inline void store(void* mem, const uint16_t& value) { *reinterpret_cast(mem) = value; } template <> -inline void store(void* mem, int32_t value) { +inline void store(void* mem, const int32_t& value) { *reinterpret_cast(mem) = value; } template <> -inline void store(void* mem, uint32_t value) { +inline void store(void* mem, const uint32_t& value) { *reinterpret_cast(mem) = value; } template <> -inline void store(void* mem, int64_t value) { +inline void store(void* mem, const int64_t& value) { *reinterpret_cast(mem) = value; } template <> -inline void store(void* mem, uint64_t value) { +inline void store(void* mem, const uint64_t& value) { *reinterpret_cast(mem) = value; } template <> -inline void store(void* mem, float value) { +inline void store(void* mem, const float& value) { *reinterpret_cast(mem) = value; } template <> -inline void store(void* mem, double value) { +inline void store(void* mem, const double& value) { *reinterpret_cast(mem) = value; } template -inline void store(const void* mem, T value) { +inline void store(const void* mem, const T& value) { if (sizeof(T) == 1) { store(mem, static_cast(value)); } else if (sizeof(T) == 2) { @@ -352,55 +352,55 @@ inline void store(const void* mem, T value) { } template -void store_and_swap(void* mem, T value); +void store_and_swap(void* mem, const T& value); template <> -inline void store_and_swap(void* mem, int8_t value) { +inline void store_and_swap(void* mem, const int8_t& value) { *reinterpret_cast(mem) = value; } template <> -inline void store_and_swap(void* mem, uint8_t value) { +inline void store_and_swap(void* mem, const uint8_t& value) { *reinterpret_cast(mem) = value; } template <> -inline void store_and_swap(void* mem, int16_t value) { +inline void store_and_swap(void* mem, const int16_t& value) { *reinterpret_cast(mem) = byte_swap(value); } template <> -inline void store_and_swap(void* mem, uint16_t value) { +inline void store_and_swap(void* mem, const uint16_t& value) { *reinterpret_cast(mem) = byte_swap(value); } template <> -inline void store_and_swap(void* mem, int32_t value) { +inline void store_and_swap(void* mem, const int32_t& value) { *reinterpret_cast(mem) = byte_swap(value); } template <> -inline void store_and_swap(void* mem, uint32_t value) { +inline void store_and_swap(void* mem, const uint32_t& value) { *reinterpret_cast(mem) = byte_swap(value); } template <> -inline void store_and_swap(void* mem, int64_t value) { +inline void store_and_swap(void* mem, const int64_t& value) { *reinterpret_cast(mem) = byte_swap(value); } template <> -inline void store_and_swap(void* mem, uint64_t value) { +inline void store_and_swap(void* mem, const uint64_t& value) { *reinterpret_cast(mem) = byte_swap(value); } template <> -inline void store_and_swap(void* mem, float value) { +inline void store_and_swap(void* mem, const float& value) { *reinterpret_cast(mem) = byte_swap(value); } template <> -inline void store_and_swap(void* mem, double value) { +inline void store_and_swap(void* mem, const double& value) { *reinterpret_cast(mem) = byte_swap(value); } template <> -inline void store_and_swap(void* mem, std::string value) { +inline void store_and_swap(void* mem, const std::string& value) { for (auto i = 0; i < value.size(); ++i) { xe::store_and_swap(reinterpret_cast(mem) + i, value[i]); } } template <> -inline void store_and_swap(void* mem, std::wstring value) { +inline void store_and_swap(void* mem, const std::wstring& value) { for (auto i = 0; i < value.size(); ++i) { xe::store_and_swap(reinterpret_cast(mem) + i, value[i]);