diff options
| author | lntue <lntue@google.com> | 2025-09-12 17:57:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-12 17:57:08 -0400 |
| commit | f019e2368b137371d248a7ddbe37f76466c2d44d (patch) | |
| tree | b645a06d4f540d9c8394c540f4234b71786f9dc1 /libc/src/string | |
| parent | 8e17f80908abd5a22acf962584371b71dffe6d15 (diff) | |
[libc] Change __builtin_memcpy to inline_memcpy. (#158345)
Diffstat (limited to 'libc/src/string')
| -rw-r--r-- | libc/src/string/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | libc/src/string/stpcpy.cpp | 3 | ||||
| -rw-r--r-- | libc/src/string/string_utils.h | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/libc/src/string/CMakeLists.txt b/libc/src/string/CMakeLists.txt index 5c9f622d4439..b8cdb2a7d353 100644 --- a/libc/src/string/CMakeLists.txt +++ b/libc/src/string/CMakeLists.txt @@ -22,6 +22,7 @@ add_header_library( libc.src.__support.CPP.type_traits libc.src.__support.CPP.simd libc.src.__support.common + libc.src.string.memory_utils.inline_memcpy ${string_config_options} ) diff --git a/libc/src/string/stpcpy.cpp b/libc/src/string/stpcpy.cpp index 48c0db950ace..fefae8117258 100644 --- a/libc/src/string/stpcpy.cpp +++ b/libc/src/string/stpcpy.cpp @@ -8,6 +8,7 @@ #include "src/string/stpcpy.h" #include "src/__support/macros/config.h" +#include "src/string/memory_utils/inline_memcpy.h" #include "src/string/string_utils.h" #include "src/__support/common.h" @@ -17,7 +18,7 @@ namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(char *, stpcpy, (char *__restrict dest, const char *__restrict src)) { size_t size = internal::string_length(src) + 1; - __builtin_memcpy(dest, src, size); + inline_memcpy(dest, src, size); char *result = dest + size; if (result != nullptr) diff --git a/libc/src/string/string_utils.h b/libc/src/string/string_utils.h index 10803488b6cf..9d636d02f475 100644 --- a/libc/src/string/string_utils.h +++ b/libc/src/string/string_utils.h @@ -21,6 +21,7 @@ #include "src/__support/CPP/type_traits.h" // cpp::is_same_v #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY +#include "src/string/memory_utils/inline_memcpy.h" #if defined(LIBC_COPT_STRING_UNSAFE_WIDE_READ) #if LIBC_HAS_VECTOR_TYPE @@ -242,7 +243,7 @@ LIBC_INLINE size_t strlcpy(char *__restrict dst, const char *__restrict src, if (!size) return len; size_t n = len < size - 1 ? len : size - 1; - __builtin_memcpy(dst, src, n); + inline_memcpy(dst, src, n); dst[n] = '\0'; return len; } |
