Browse Source

hashed_string: avoid magic numbers in return statements

Michele Caini 1 year ago
parent
commit
288fcdaf53
1 changed files with 8 additions and 4 deletions
  1. 8 4
      src/entt/core/hashed_string.hpp

+ 8 - 4
src/entt/core/hashed_string.hpp

@@ -13,17 +13,21 @@ namespace internal {
 
 
 [[nodiscard]] inline constexpr auto offset() noexcept {
 [[nodiscard]] inline constexpr auto offset() noexcept {
     if constexpr(std::is_same_v<id_type, std::uint32_t>) {
     if constexpr(std::is_same_v<id_type, std::uint32_t>) {
-        return 2166136261;
+        constexpr auto offset_value = 2166136261;
+        return offset_value;
     } else if constexpr(std::is_same_v<id_type, std::uint64_t>) {
     } else if constexpr(std::is_same_v<id_type, std::uint64_t>) {
-        return 14695981039346656037ull;
+        constexpr auto offset_value = 14695981039346656037ull;
+        return offset_value;
     }
     }
 }
 }
 
 
 [[nodiscard]] inline constexpr auto prime() noexcept {
 [[nodiscard]] inline constexpr auto prime() noexcept {
     if constexpr(std::is_same_v<id_type, std::uint32_t>) {
     if constexpr(std::is_same_v<id_type, std::uint32_t>) {
-        return 16777619;
+        constexpr auto prime_value = 16777619;
+        return prime_value;
     } else if constexpr(std::is_same_v<id_type, std::uint64_t>) {
     } else if constexpr(std::is_same_v<id_type, std::uint64_t>) {
-        return 1099511628211ull;
+        constexpr auto prime_value = 1099511628211ull;
+        return prime_value;
     }
     }
 }
 }