From 51d8c4be180d013455fd8739aff595f9416a7d3f Mon Sep 17 00:00:00 2001 From: 2LoS Date: Wed, 5 Nov 2025 21:12:03 +0100 Subject: Minor changes --- dev/CompilerKit/UUID.h | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'dev/CompilerKit/UUID.h') diff --git a/dev/CompilerKit/UUID.h b/dev/CompilerKit/UUID.h index 39db276..1218fab 100644 --- a/dev/CompilerKit/UUID.h +++ b/dev/CompilerKit/UUID.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -84,17 +85,9 @@ namespace Detail { return 0; } - template - [[nodiscard]] constexpr inline bool is_hex(TChar const ch) noexcept { - return (ch >= static_cast('0') && ch <= static_cast('9')) || - (ch >= static_cast('a') && ch <= static_cast('f')) || - (ch >= static_cast('A') && ch <= static_cast('F')); - } - template [[nodiscard]] constexpr std::basic_string_view to_string_view(TChar const* str) noexcept { - if (str) return str; - return {}; + return str; } template @@ -437,7 +430,7 @@ class uuid { for (size_t i = hasBraces; i < str.size() - hasBraces; ++i) { if (str[i] == '-') continue; - if (index >= 16 || !Detail::is_hex(str[i])) { + if (index >= 16 || !std::isxdigit(static_cast(str[i]))) { return false; } @@ -474,7 +467,7 @@ class uuid { for (size_t i = hasBraces; i < str.size() - hasBraces; ++i) { if (str[i] == '-') continue; - if (index >= 16 || !Detail::is_hex(str[i])) { + if (index >= 16 || !std::isxdigit(static_cast(str[i]))) { return {}; } @@ -600,11 +593,10 @@ class uuid_system_generator { static_cast((newId.Data1 >> 16) & 0xFF), static_cast((newId.Data1 >> 8) & 0xFF), static_cast((newId.Data1) & 0xFF), - - (unsigned char) ((newId.Data2 >> 8) & 0xFF), (unsigned char) ((newId.Data2) & 0xFF), - - (unsigned char) ((newId.Data3 >> 8) & 0xFF), (unsigned char) ((newId.Data3) & 0xFF), - + static_cast((newId.Data2 >> 8) & 0xFF), + static_cast((newId.Data2) & 0xFF), + static_cast((newId.Data3 >> 8) & 0xFF), + static_cast((newId.Data3) & 0xFF), newId.Data4[0], newId.Data4[1], newId.Data4[2], newId.Data4[3], newId.Data4[4], newId.Data4[5], newId.Data4[6], newId.Data4[7]}}; @@ -832,4 +824,4 @@ struct hash { }; } // namespace std -#endif /* STDUUID_H */ \ No newline at end of file +#endif /* STDUUID_H */ -- cgit v1.2.3