[libc] Switched calls to inline_memcpy to __builtin_memcpy for wide char utilities (#143011)

Switched calls to inline_memcpy to __builtin_memcpy for wide char
utilities
Removed unnecessary wctype_utils dependencies from the cmake file
This commit is contained in:
Uzair Nawaz
2025-06-11 20:17:35 +00:00
committed by GitHub
parent b42aef5e6f
commit e389a0e7bb
5 changed files with 3 additions and 17 deletions

View File

@@ -43,7 +43,6 @@ add_entrypoint_object(
DEPENDS
libc.hdr.types.size_t
libc.hdr.types.wchar_t
libc.src.__support.wctype_utils
)
add_entrypoint_object(
@@ -54,7 +53,6 @@ add_entrypoint_object(
wcschr.h
DEPENDS
libc.hdr.wchar_macros
libc.src.__support.wctype_utils
)
add_entrypoint_object(
@@ -75,7 +73,6 @@ add_entrypoint_object(
wcspbrk.h
DEPENDS
libc.hdr.wchar_macros
libc.src.__support.wctype_utils
libc.src.__support.macros.null_check
)
@@ -109,7 +106,6 @@ add_entrypoint_object(
DEPENDS
libc.hdr.wchar_macros
libc.hdr.types.size_t
libc.src.__support.wctype_utils
)
add_entrypoint_object(
@@ -121,7 +117,6 @@ add_entrypoint_object(
DEPENDS
libc.hdr.types.size_t
libc.hdr.wchar_macros
libc.src.__support.wctype_utils
libc.src.__support.macros.null_check
)
@@ -134,7 +129,6 @@ add_entrypoint_object(
DEPENDS
libc.hdr.types.size_t
libc.hdr.wchar_macros
libc.src.__support.wctype_utils
)
add_entrypoint_object(
@@ -205,8 +199,6 @@ add_entrypoint_object(
DEPENDS
libc.hdr.types.size_t
libc.hdr.wchar_macros
libc.src.__support.wctype_utils
libc.src.string.memory_utils.inline_memcpy
)
add_entrypoint_object(
@@ -218,6 +210,5 @@ add_entrypoint_object(
DEPENDS
libc.hdr.types.size_t
libc.hdr.wchar_macros
libc.src.string.memory_utils.inline_memcpy
libc.src.string.string_utils
)

View File

@@ -12,7 +12,6 @@
#include "hdr/types/wchar_t.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/string/memory_utils/inline_memcpy.h"
#include "src/string/string_utils.h"
namespace LIBC_NAMESPACE_DECL {
@@ -20,7 +19,7 @@ namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(wchar_t *, wcscpy,
(wchar_t *__restrict s1, const wchar_t *__restrict s2)) {
size_t size = internal::string_length(s2) + 1;
inline_memcpy(s1, s2, size * sizeof(wchar_t));
__builtin_memcpy(s1, s2, size * sizeof(wchar_t));
return s1;
}

View File

@@ -12,8 +12,6 @@
#include "hdr/types/wchar_t.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/string/memory_utils/inline_memcpy.h"
#include "src/string/string_utils.h"
namespace LIBC_NAMESPACE_DECL {

View File

@@ -12,14 +12,13 @@
#include "hdr/types/wchar_t.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
#include "src/string/memory_utils/inline_memcpy.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(wchar_t *, wmemcpy,
(wchar_t *__restrict s1, const wchar_t *__restrict s2,
size_t n)) {
inline_memcpy(s1, s2, n * sizeof(wchar_t));
__builtin_memcpy(s1, s2, n * sizeof(wchar_t));
return s1;
}

View File

@@ -11,14 +11,13 @@
#include "hdr/types/size_t.h"
#include "hdr/types/wchar_t.h"
#include "src/__support/common.h"
#include "src/string/memory_utils/inline_memcpy.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(wchar_t *, wmempcpy,
(wchar_t *__restrict to, const wchar_t *__restrict from,
size_t size)) {
inline_memcpy(to, from, size * sizeof(wchar_t));
__builtin_memcpy(to, from, size * sizeof(wchar_t));
return reinterpret_cast<wchar_t *>(to) + size;
}