You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Use std::size instead of sizeof(a) / sizeof(a[0]) pattern throughout the codebase.
This commit is contained in:
@@ -5244,7 +5244,7 @@ ShaderLanguage::DataType ShaderLanguage::get_scalar_type(DataType p_type) {
|
||||
TYPE_VOID,
|
||||
};
|
||||
|
||||
static_assert(sizeof(scalar_types) / sizeof(*scalar_types) == TYPE_MAX);
|
||||
static_assert(std::size(scalar_types) == TYPE_MAX);
|
||||
|
||||
return scalar_types[p_type];
|
||||
}
|
||||
@@ -5286,7 +5286,7 @@ int ShaderLanguage::get_cardinality(DataType p_type) {
|
||||
1,
|
||||
};
|
||||
|
||||
static_assert(sizeof(cardinality_table) / sizeof(*cardinality_table) == TYPE_MAX);
|
||||
static_assert(std::size(cardinality_table) == TYPE_MAX);
|
||||
|
||||
return cardinality_table[p_type];
|
||||
}
|
||||
@@ -11217,7 +11217,7 @@ Error ShaderLanguage::complete(const String &p_code, const ShaderCompileInfo &p_
|
||||
#ifdef DEBUG_ENABLED
|
||||
// Adds context keywords.
|
||||
if (keyword_completion_context != CF_UNSPECIFIED) {
|
||||
int sz = sizeof(keyword_list) / sizeof(KeyWord);
|
||||
constexpr int sz = std::size(keyword_list);
|
||||
for (int i = 0; i < sz; i++) {
|
||||
if (keyword_list[i].flags == CF_UNSPECIFIED) {
|
||||
break; // Ignore hint keywords (parsed below).
|
||||
|
||||
Reference in New Issue
Block a user