mirror of
https://github.com/Tencent/MMKV.git
synced 2026-10-16 20:21:12 +08:00
opt move assignment operator of MMBuffer
This commit is contained in:
+2
-5
@@ -170,11 +170,8 @@ MMBuffer &MMBuffer::operator=(MMBuffer &&other) noexcept {
|
||||
#endif
|
||||
other.detach();
|
||||
} else {
|
||||
uint8_t tmp[SmallBufferSize()];
|
||||
memcpy(tmp, other.paddedBuffer, other.paddedSize);
|
||||
memcpy(other.paddedBuffer, paddedBuffer, paddedSize);
|
||||
memcpy(paddedBuffer, tmp, other.paddedSize);
|
||||
std::swap(paddedSize, other.paddedSize);
|
||||
paddedSize = other.paddedSize;
|
||||
memcpy(paddedBuffer, other.paddedBuffer, other.paddedSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user