summaryrefslogtreecommitdiffstats
path: root/modules/gltf/gltf_document.cpp
diff options
context:
space:
mode:
authorClay John <claynjohn@gmail.com>2023-05-05 09:56:48 -0700
committerGitHub <noreply@github.com>2023-05-05 09:56:48 -0700
commit610877e32651ecc10d1f530def7576b8d0429a28 (patch)
treead98207d1ff2a1ad052327b68987662f09e496bb /modules/gltf/gltf_document.cpp
parent214a848e0fc5208b747f2f5ed6d0894084b7414e (diff)
parent6b84e258d20e007fd7c95ac2d4f9244bd93edc13 (diff)
downloadredot-engine-610877e32651ecc10d1f530def7576b8d0429a28.tar.gz
Merge pull request #72288 from MewPurPur/use-string-repeat
Use `String.repeat()` to optimize several String methods
Diffstat (limited to 'modules/gltf/gltf_document.cpp')
-rw-r--r--modules/gltf/gltf_document.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index 4a07183b0d..251aa6375f 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -7190,9 +7190,9 @@ PackedByteArray GLTFDocument::_serialize_glb_buffer(Ref<GLTFState> p_state, Erro
const int32_t header_size = 12;
const int32_t chunk_header_size = 8;
- for (int32_t pad_i = 0; pad_i < (chunk_header_size + json.utf8().length()) % 4; pad_i++) {
- json += " ";
- }
+ int32_t padding = (chunk_header_size + json.utf8().length()) % 4;
+ json += String(" ").repeat(padding);
+
CharString cs = json.utf8();
const uint32_t text_chunk_length = cs.length();