Przeglądaj źródła

stl: std::uint8/16/32/64_t

skypjack 2 dni temu
rodzic
commit
e929304ed4

+ 3 - 3
src/entt/config/config.h

@@ -43,10 +43,10 @@
 #endif
 
 #ifndef ENTT_ID_TYPE
-#    include <cstdint>
-#    define ENTT_ID_TYPE std::uint32_t
+#    include "../stl/cstdint.hpp"
+#    define ENTT_ID_TYPE stl::uint32_t
 #else
-#    include <cstdint> // provides coverage for types in the std namespace
+#    include "../stl/cstdint.hpp" // provides coverage for types in the std namespace
 #endif
 
 #ifndef ENTT_SPARSE_PAGE

+ 2 - 1
src/entt/core/any.hpp

@@ -6,6 +6,7 @@
 #include "../config/config.h"
 #include "../core/concepts.hpp"
 #include "../stl/cstddef.hpp"
+#include "../stl/cstdint.hpp"
 #include "../stl/type_traits.hpp"
 #include "../stl/utility.hpp"
 #include "fwd.hpp"
@@ -18,7 +19,7 @@ namespace entt {
 /*! @cond ENTT_INTERNAL */
 namespace internal {
 
-enum class any_request : std::uint8_t {
+enum class any_request : stl::uint8_t {
     info,
     transfer,
     assign,

+ 1 - 1
src/entt/core/fwd.hpp

@@ -8,7 +8,7 @@
 namespace entt {
 
 /*! @brief Possible modes of an any object. */
-enum class any_policy : std::uint8_t {
+enum class any_policy : stl::uint8_t {
     /*! @brief Default mode, no element available. */
     empty,
     /*! @brief Owning mode, dynamically allocated element. */

+ 2 - 2
src/entt/core/hashed_string.hpp

@@ -14,13 +14,13 @@ template<typename = id_type>
 struct fnv_1a_params;
 
 template<>
-struct fnv_1a_params<std::uint32_t> {
+struct fnv_1a_params<stl::uint32_t> {
     static constexpr auto offset = 2166136261;
     static constexpr auto prime = 16777619;
 };
 
 template<>
-struct fnv_1a_params<std::uint64_t> {
+struct fnv_1a_params<stl::uint64_t> {
     static constexpr auto offset = 14695981039346656037ull;
     static constexpr auto prime = 1099511628211ull;
 };

+ 8 - 8
src/entt/entity/entity.hpp

@@ -35,22 +35,22 @@ struct entt_traits<Type>
 };
 
 template<>
-struct entt_traits<std::uint32_t> {
-    using value_type = std::uint32_t;
+struct entt_traits<stl::uint32_t> {
+    using value_type = stl::uint32_t;
 
-    using entity_type = std::uint32_t;
-    using version_type = std::uint16_t;
+    using entity_type = stl::uint32_t;
+    using version_type = stl::uint16_t;
 
     static constexpr entity_type entity_mask = 0xFFFFF;
     static constexpr entity_type version_mask = 0xFFF;
 };
 
 template<>
-struct entt_traits<std::uint64_t> {
-    using value_type = std::uint64_t;
+struct entt_traits<stl::uint64_t> {
+    using value_type = stl::uint64_t;
 
-    using entity_type = std::uint64_t;
-    using version_type = std::uint32_t;
+    using entity_type = stl::uint64_t;
+    using version_type = stl::uint32_t;
 
     static constexpr entity_type entity_mask = 0xFFFFFFFF;
     static constexpr entity_type version_mask = 0xFFFFFFFF;

+ 1 - 1
src/entt/entity/fwd.hpp

@@ -15,7 +15,7 @@ namespace entt {
 enum class entity : id_type {};
 
 /*! @brief Storage deletion policy. */
-enum class deletion_policy : std::uint8_t {
+enum class deletion_policy : stl::uint8_t {
     /*! @brief Swap-and-pop deletion policy. */
     swap_and_pop = 0u,
     /*! @brief In-place deletion policy. */

+ 2 - 1
src/entt/meta/node.hpp

@@ -13,6 +13,7 @@
 #include "../core/utility.hpp"
 #include "../stl/array.hpp"
 #include "../stl/cstddef.hpp"
+#include "../stl/cstdint.hpp"
 #include "../stl/type_traits.hpp"
 #include "../stl/utility.hpp"
 #include "../stl/vector.hpp"
@@ -25,7 +26,7 @@ namespace entt {
 /*! @cond ENTT_INTERNAL */
 namespace internal {
 
-enum class meta_traits : std::uint32_t {
+enum class meta_traits : stl::uint32_t {
     is_none = 0x0000,
     is_const = 0x0001,
     is_static = 0x0002,

+ 2 - 2
src/entt/process/fwd.hpp

@@ -10,13 +10,13 @@ template<typename, typename = std::allocator<void>>
 class basic_process;
 
 /*! @brief Alias declaration for the most common use case. */
-using process = basic_process<std::uint32_t>;
+using process = basic_process<stl::uint32_t>;
 
 template<typename, typename = std::allocator<void>>
 class basic_scheduler;
 
 /*! @brief Alias declaration for the most common use case. */
-using scheduler = basic_scheduler<std::uint32_t>;
+using scheduler = basic_scheduler<stl::uint32_t>;
 
 } // namespace entt
 

+ 1 - 1
src/entt/process/process.hpp

@@ -70,7 +70,7 @@ struct process_adaptor;
  */
 template<typename Delta, typename Allocator>
 class basic_process: public std::enable_shared_from_this<basic_process<Delta, Allocator>> {
-    enum class state : std::uint8_t {
+    enum class state : stl::uint8_t {
         idle = 0,
         running,
         paused,

+ 4 - 1
src/entt/stl/cstdint.hpp

@@ -6,7 +6,10 @@
 /*! @cond ENTT_INTERNAL */
 namespace entt::stl {
 
-using std::size_t;
+using std::uint16_t;
+using std::uint32_t;
+using std::uint64_t;
+using std::uint8_t;
 
 } // namespace entt::stl
 /*! @endcond */

+ 2 - 2
src/entt/tools/davey.hpp

@@ -56,7 +56,7 @@ static void present_element(const meta_any &obj, OnEntity on_entity) {
             if(as_string) {
                 ImGui::Text("%s: %s", label, as_string);
             } else {
-                ImGui::Text("%s: %zu", label, elem.template allow_cast<std::uint64_t>().template cast<std::uint64_t>());
+                ImGui::Text("%s: %zu", label, elem.template allow_cast<stl::uint64_t>().template cast<stl::uint64_t>());
             }
         } else if(type.is_arithmetic()) {
             if(type.info() == type_id<bool>()) {
@@ -66,7 +66,7 @@ static void present_element(const meta_any &obj, OnEntity on_entity) {
             } else if(type.info() == type_id<char>()) {
                 ImGui::Text("%s: %c", label, elem.template cast<char>());
             } else if(type.is_integral()) {
-                ImGui::Text("%s: %zu", label, elem.template allow_cast<std::uint64_t>().template cast<std::uint64_t>());
+                ImGui::Text("%s: %zu", label, elem.template allow_cast<stl::uint64_t>().template cast<stl::uint64_t>());
             } else {
                 ImGui::Text("%s: %f", label, elem.template allow_cast<double>().template cast<double>());
             }