[libc-commits] [libc] [libc] Speed up memmove overlapping check (PR #70017)

via libc-commits libc-commits at lists.llvm.org
Tue Oct 24 02:23:13 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 97f1db2fdd5810e15d152167e9f1e29159a8cee9 015d71287da4343ccb210fd2e9a3b9d814ff0605 -- libc/src/string/memory_utils/utils.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/string/memory_utils/utils.h b/libc/src/string/memory_utils/utils.h
index d3e5a4ea7762..c6939bab3521 100644
--- a/libc/src/string/memory_utils/utils.h
+++ b/libc/src/string/memory_utils/utils.h
@@ -89,7 +89,8 @@ template <size_t alignment, typename T> LIBC_INLINE T *assume_aligned(T *ptr) {
 // Returns true iff memory regions [p1, p1 + size] and [p2, p2 + size] are
 // disjoint.
 LIBC_INLINE bool is_disjoint(const void *p1, const void *p2, size_t size) {
-  const size_t diff = static_cast<const char *>(p1) - static_cast<const char *>(p2);
+  const size_t diff =
+      static_cast<const char *>(p1) - static_cast<const char *>(p2);
   // This is expected to compile to conditional move.
   return static_cast<ptrdiff_t>(diff) >= 0 ? size <= diff : size <= -diff;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/70017


More information about the libc-commits mailing list