diff options
author | Marcin Kowalczyk <qrczak@google.com> | 2022-06-09 14:28:22 +0000 |
---|---|---|
committer | Victor Costan <pwnall@chromium.org> | 2022-07-27 15:28:08 +0000 |
commit | 44caf79086541716b0fce0fe7047cb76e4165b04 (patch) | |
tree | 51531b255f08b6c958ea5ab83139ec8595020835 | |
parent | d261d2766fa6c7932994ed3c5b14d7911629c971 (diff) | |
download | snappy-git-44caf79086541716b0fce0fe7047cb76e4165b04.tar.gz |
Move the comment about non-overlap requirement from the implementation to the
contract of `MemCopy64()`, and clarify that it applies to `size`, not to 64.
PiperOrigin-RevId: 453920284
-rw-r--r-- | snappy.cc | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -985,7 +985,8 @@ inline bool Copy64BytesWithPatternExtension(ptrdiff_t dst, size_t offset) { // Copies between size bytes and 64 bytes from src to dest. size cannot exceed // 64. More than size bytes, but never exceeding 64, might be copied if doing -// so gives better performance. +// so gives better performance. [src, src + size) must not overlap with +// [dst, dst + size), but [src, src + 64) may overlap with [dst, dst + 64). void MemCopy64(char* dst, const void* src, size_t size) { // Always copy this many bytes, test if we need to copy more. constexpr int kShortMemCopy = 32; @@ -994,7 +995,6 @@ void MemCopy64(char* dst, const void* src, size_t size) { constexpr int kLongMemCopy = 64; assert(size <= kLongMemCopy); - // [src, src + size) must not overlap with [dst, dst + size) assert(std::less_equal<const void*>()(static_cast<const char*>(src) + size, dst) || std::less_equal<const void*>()(dst + size, src)); |