Reduced a useless memory copy in tstring.cpp.

This commit is contained in:
Tsuda Kageyu 2014-02-15 20:25:00 +09:00
parent 3e0c73bdbc
commit 69eaa75f64

View File

@ -805,12 +805,13 @@ void String::copyFromUTF16(const wchar_t *s, size_t length, Type t)
d->data.resize(length);
if(length > 0) {
memcpy(&d->data[0], s, length * sizeof(wchar_t));
if(swap) {
for(size_t i = 0; i < length; ++i)
d->data[i] = Utils::byteSwap(static_cast<ushort>(s[i]));
}
else {
::memcpy(&d->data[0], s, length * sizeof(wchar_t));
}
}
}