diff options
| -rw-r--r-- | src/common/alignment.h | 4 | ||||
| -rw-r--r-- | src/common/bit_set.h | 2 | ||||
| -rw-r--r-- | src/common/file_util.h | 10 | ||||
| -rw-r--r-- | src/common/hash.h | 4 | ||||
| -rw-r--r-- | src/common/x64/xbyak_util.h | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h index b77da4a92..b9dd38746 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h | |||
| @@ -9,13 +9,13 @@ namespace Common { | |||
| 9 | 9 | ||
| 10 | template <typename T> | 10 | template <typename T> |
| 11 | constexpr T AlignUp(T value, size_t size) { | 11 | constexpr T AlignUp(T value, size_t size) { |
| 12 | static_assert(std::is_unsigned<T>::value, "T must be an unsigned value."); | 12 | static_assert(std::is_unsigned_v<T>, "T must be an unsigned value."); |
| 13 | return static_cast<T>(value + (size - value % size) % size); | 13 | return static_cast<T>(value + (size - value % size) % size); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | template <typename T> | 16 | template <typename T> |
| 17 | constexpr T AlignDown(T value, size_t size) { | 17 | constexpr T AlignDown(T value, size_t size) { |
| 18 | static_assert(std::is_unsigned<T>::value, "T must be an unsigned value."); | 18 | static_assert(std::is_unsigned_v<T>, "T must be an unsigned value."); |
| 19 | return static_cast<T>(value - value % size); | 19 | return static_cast<T>(value - value % size); |
| 20 | } | 20 | } |
| 21 | 21 | ||
diff --git a/src/common/bit_set.h b/src/common/bit_set.h index 84e3cbe58..5a197d8c1 100644 --- a/src/common/bit_set.h +++ b/src/common/bit_set.h | |||
| @@ -96,7 +96,7 @@ static inline int LeastSignificantSetBit(u64 val) { | |||
| 96 | 96 | ||
| 97 | template <typename IntTy> | 97 | template <typename IntTy> |
| 98 | class BitSet { | 98 | class BitSet { |
| 99 | static_assert(!std::is_signed<IntTy>::value, "BitSet should not be used with signed types"); | 99 | static_assert(!std::is_signed_v<IntTy>, "BitSet should not be used with signed types"); |
| 100 | 100 | ||
| 101 | public: | 101 | public: |
| 102 | // A reference to a particular bit, returned from operator[]. | 102 | // A reference to a particular bit, returned from operator[]. |
diff --git a/src/common/file_util.h b/src/common/file_util.h index 28697d527..7f2a5cb63 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h | |||
| @@ -207,7 +207,7 @@ public: | |||
| 207 | 207 | ||
| 208 | template <typename T> | 208 | template <typename T> |
| 209 | size_t ReadArray(T* data, size_t length) const { | 209 | size_t ReadArray(T* data, size_t length) const { |
| 210 | static_assert(std::is_trivially_copyable<T>(), | 210 | static_assert(std::is_trivially_copyable_v<T>, |
| 211 | "Given array does not consist of trivially copyable objects"); | 211 | "Given array does not consist of trivially copyable objects"); |
| 212 | 212 | ||
| 213 | if (!IsOpen()) | 213 | if (!IsOpen()) |
| @@ -218,7 +218,7 @@ public: | |||
| 218 | 218 | ||
| 219 | template <typename T> | 219 | template <typename T> |
| 220 | size_t WriteArray(const T* data, size_t length) { | 220 | size_t WriteArray(const T* data, size_t length) { |
| 221 | static_assert(std::is_trivially_copyable<T>(), | 221 | static_assert(std::is_trivially_copyable_v<T>, |
| 222 | "Given array does not consist of trivially copyable objects"); | 222 | "Given array does not consist of trivially copyable objects"); |
| 223 | if (!IsOpen()) | 223 | if (!IsOpen()) |
| 224 | return -1; | 224 | return -1; |
| @@ -227,19 +227,19 @@ public: | |||
| 227 | 227 | ||
| 228 | template <typename T> | 228 | template <typename T> |
| 229 | size_t ReadBytes(T* data, size_t length) const { | 229 | size_t ReadBytes(T* data, size_t length) const { |
| 230 | static_assert(std::is_trivially_copyable<T>(), "T must be trivially copyable"); | 230 | static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable"); |
| 231 | return ReadArray(reinterpret_cast<char*>(data), length); | 231 | return ReadArray(reinterpret_cast<char*>(data), length); |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | template <typename T> | 234 | template <typename T> |
| 235 | size_t WriteBytes(const T* data, size_t length) { | 235 | size_t WriteBytes(const T* data, size_t length) { |
| 236 | static_assert(std::is_trivially_copyable<T>(), "T must be trivially copyable"); | 236 | static_assert(std::is_trivially_copyable_v<T>, "T must be trivially copyable"); |
| 237 | return WriteArray(reinterpret_cast<const char*>(data), length); | 237 | return WriteArray(reinterpret_cast<const char*>(data), length); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | template <typename T> | 240 | template <typename T> |
| 241 | size_t WriteObject(const T& object) { | 241 | size_t WriteObject(const T& object) { |
| 242 | static_assert(!std::is_pointer<T>::value, "Given object is a pointer"); | 242 | static_assert(!std::is_pointer_v<T>, "WriteObject arguments must not be a pointer"); |
| 243 | return WriteArray(&object, 1); | 243 | return WriteArray(&object, 1); |
| 244 | } | 244 | } |
| 245 | 245 | ||
diff --git a/src/common/hash.h b/src/common/hash.h index 73c326980..2c761e545 100644 --- a/src/common/hash.h +++ b/src/common/hash.h | |||
| @@ -28,7 +28,7 @@ static inline u64 ComputeHash64(const void* data, size_t len) { | |||
| 28 | */ | 28 | */ |
| 29 | template <typename T> | 29 | template <typename T> |
| 30 | static inline u64 ComputeStructHash64(const T& data) { | 30 | static inline u64 ComputeStructHash64(const T& data) { |
| 31 | static_assert(std::is_trivially_copyable<T>(), | 31 | static_assert(std::is_trivially_copyable_v<T>, |
| 32 | "Type passed to ComputeStructHash64 must be trivially copyable"); | 32 | "Type passed to ComputeStructHash64 must be trivially copyable"); |
| 33 | return ComputeHash64(&data, sizeof(data)); | 33 | return ComputeHash64(&data, sizeof(data)); |
| 34 | } | 34 | } |
| @@ -38,7 +38,7 @@ template <typename T> | |||
| 38 | struct HashableStruct { | 38 | struct HashableStruct { |
| 39 | // In addition to being trivially copyable, T must also have a trivial default constructor, | 39 | // In addition to being trivially copyable, T must also have a trivial default constructor, |
| 40 | // because any member initialization would be overridden by memset | 40 | // because any member initialization would be overridden by memset |
| 41 | static_assert(std::is_trivial<T>(), "Type passed to HashableStruct must be trivial"); | 41 | static_assert(std::is_trivial_v<T>, "Type passed to HashableStruct must be trivial"); |
| 42 | /* | 42 | /* |
| 43 | * We use a union because "implicitly-defined copy/move constructor for a union X copies the | 43 | * We use a union because "implicitly-defined copy/move constructor for a union X copies the |
| 44 | * object representation of X." and "implicitly-defined copy assignment operator for a union X | 44 | * object representation of X." and "implicitly-defined copy assignment operator for a union X |
diff --git a/src/common/x64/xbyak_util.h b/src/common/x64/xbyak_util.h index 0f52f704b..ec76e0a47 100644 --- a/src/common/x64/xbyak_util.h +++ b/src/common/x64/xbyak_util.h | |||
| @@ -34,7 +34,7 @@ inline bool IsWithin2G(const Xbyak::CodeGenerator& code, uintptr_t target) { | |||
| 34 | 34 | ||
| 35 | template <typename T> | 35 | template <typename T> |
| 36 | inline void CallFarFunction(Xbyak::CodeGenerator& code, const T f) { | 36 | inline void CallFarFunction(Xbyak::CodeGenerator& code, const T f) { |
| 37 | static_assert(std::is_pointer<T>(), "Argument must be a (function) pointer."); | 37 | static_assert(std::is_pointer_v<T>, "Argument must be a (function) pointer."); |
| 38 | size_t addr = reinterpret_cast<size_t>(f); | 38 | size_t addr = reinterpret_cast<size_t>(f); |
| 39 | if (IsWithin2G(code, addr)) { | 39 | if (IsWithin2G(code, addr)) { |
| 40 | code.call(f); | 40 | code.call(f); |