Optimize String::copy_from_unchecked
This commit is contained in:
parent
069e8f32d8
commit
3d35f29f27
1 changed files with 2 additions and 5 deletions
|
@ -266,13 +266,10 @@ void String::copy_from(const CharType *p_cstr, const int p_clip_to) {
|
||||||
// p_length <= p_char strlen
|
// p_length <= p_char strlen
|
||||||
void String::copy_from_unchecked(const CharType *p_char, const int p_length) {
|
void String::copy_from_unchecked(const CharType *p_char, const int p_length) {
|
||||||
resize(p_length + 1);
|
resize(p_length + 1);
|
||||||
set(p_length, 0);
|
|
||||||
|
|
||||||
CharType *dst = ptrw();
|
CharType *dst = ptrw();
|
||||||
|
memcpy(dst, p_char, p_length * sizeof(CharType));
|
||||||
for (int i = 0; i < p_length; i++) {
|
dst[p_length] = 0;
|
||||||
dst[i] = p_char[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void String::copy_from(const CharType &p_char) {
|
void String::copy_from(const CharType &p_char) {
|
||||||
|
|
Loading…
Reference in a new issue