opt move assignment operator of MMBuffer

This commit is contained in:
guoling
2025-09-18 19:33:05 +08:00
parent e742adcc23
commit 0fce41f270
+2 -5
View File
@@ -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);
}
}