[libc-commits] [PATCH] D109316: [libc] Some clean work with memmove.
Cheng Wang via Phabricator via libc-commits
libc-commits at lists.llvm.org
Mon Sep 6 04:39:13 PDT 2021
cheng.w added inline comments.
================
Comment at: libc/src/string/memmove.cpp:52-55
// TODO: Optimize `move_byte_xxx(...)` functions.
- if (dest_c < src_c)
- move_byte_forward(dest_c, src_c, count);
- if (dest_c > src_c)
- move_byte_backward(dest_c, src_c, count);
- return dest;
+ if (dst > src)
+ move_byte_backward(dst, src, count);
+}
----------------
@gchatelet Is it possible to have an elementary operation `CopyBackward`? It copies aligned `kBlockSize` bytes backward.
Acting like:
```
CopyBackward<kBlockSize>(dst, src, count) {
for (size_t i = count / kBlockSize; i > 0; --i)
Copy(dst + i * kBlockSize, src + i * kBlockSize, kBlockSize)
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109316/new/
https://reviews.llvm.org/D109316
More information about the libc-commits
mailing list