diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 11:30:50 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 11:31:10 +0300 |
commit | c7b247a118e302a3afc6473797e53b6af28b69e2 (patch) | |
tree | d11149a165bfd8f3b3b791f24547499f041b133b /source/blender/depsgraph | |
parent | 891949cbb47143420f4324cb60efc05ef5d70b39 (diff) |
Cleanup: replace static_casts with functional casts for numeric types
Diffstat (limited to 'source/blender/depsgraph')
4 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cache.cc b/source/blender/depsgraph/intern/builder/deg_builder_cache.cc index 129e0093d11..0a86cd62576 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_cache.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_cache.cc @@ -61,7 +61,7 @@ uint64_t AnimatedPropertyID::hash() const { uintptr_t ptr1 = (uintptr_t)data; uintptr_t ptr2 = (uintptr_t)property_rna; - return static_cast<uint64_t>(((ptr1 >> 4) * 33) ^ (ptr2 >> 4)); + return uint64_t(((ptr1 >> 4) * 33) ^ (ptr2 >> 4)); } namespace { diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc index ebb4450579f..640f529f7fb 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.cc +++ b/source/blender/depsgraph/intern/node/deg_node_component.cc @@ -48,7 +48,7 @@ ComponentNode::OperationIDKey::OperationIDKey(OperationCode opcode, const char * string ComponentNode::OperationIDKey::identifier() const { - const string codebuf = to_string(static_cast<int>(opcode)); + const string codebuf = to_string(int(opcode)); return "OperationIDKey(" + codebuf + ", " + name + ")"; } @@ -59,7 +59,7 @@ bool ComponentNode::OperationIDKey::operator==(const OperationIDKey &other) cons uint64_t ComponentNode::OperationIDKey::hash() const { - const int opcode_as_int = static_cast<int>(opcode); + const int opcode_as_int = int(opcode); return BLI_ghashutil_combine_hash( name_tag, BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(opcode_as_int), diff --git a/source/blender/depsgraph/intern/node/deg_node_factory.cc b/source/blender/depsgraph/intern/node/deg_node_factory.cc index bcdfdbec604..4c08d4ee7bb 100644 --- a/source/blender/depsgraph/intern/node/deg_node_factory.cc +++ b/source/blender/depsgraph/intern/node/deg_node_factory.cc @@ -10,19 +10,19 @@ namespace blender::deg { /* Global type registry */ -static DepsNodeFactory *node_typeinfo_registry[static_cast<int>(NodeType::NUM_TYPES)] = {nullptr}; +static DepsNodeFactory *node_typeinfo_registry[int(NodeType::NUM_TYPES)] = {nullptr}; void register_node_typeinfo(DepsNodeFactory *factory) { BLI_assert(factory != nullptr); - const int type_as_int = static_cast<int>(factory->type()); + const int type_as_int = int(factory->type()); node_typeinfo_registry[type_as_int] = factory; } DepsNodeFactory *type_get_factory(const NodeType type) { /* Look up type - at worst, it doesn't exist in table yet, and we fail. */ - const int type_as_int = static_cast<int>(type); + const int type_as_int = int(type); return node_typeinfo_registry[type_as_int]; } diff --git a/source/blender/depsgraph/intern/node/deg_node_id.cc b/source/blender/depsgraph/intern/node/deg_node_id.cc index 735d606ac9e..7cbee76e709 100644 --- a/source/blender/depsgraph/intern/node/deg_node_id.cc +++ b/source/blender/depsgraph/intern/node/deg_node_id.cc @@ -52,7 +52,7 @@ bool IDNode::ComponentIDKey::operator==(const ComponentIDKey &other) const uint64_t IDNode::ComponentIDKey::hash() const { - const int type_as_int = static_cast<int>(type); + const int type_as_int = int(type); return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(type_as_int), BLI_ghashutil_strhash_p(name)); } @@ -190,7 +190,7 @@ IDComponentsMask IDNode::get_visible_components_mask() const IDComponentsMask result = 0; for (ComponentNode *comp_node : components.values()) { if (comp_node->possibly_affects_visible_id) { - const int component_type_as_int = static_cast<int>(comp_node->type); + const int component_type_as_int = int(comp_node->type); BLI_assert(component_type_as_int < 64); result |= (1ULL << component_type_as_int); } |