mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Merge pull request #102419 from Ivorforce/std-size
Use `std::size` instead of `sizeof(a) / sizeof(a[0])` pattern throughout the codebase.
This commit is contained in:
commit
c937b6d180
33 changed files with 71 additions and 67 deletions
|
@ -5245,7 +5245,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];
|
||||
}
|
||||
|
@ -5287,7 +5287,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];
|
||||
}
|
||||
|
@ -11231,7 +11231,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).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue