Skip to content

Commit e389a0e

Browse files
authored
[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
1 parent b42aef5 commit e389a0e

File tree

5 files changed

+3
-17
lines changed

5 files changed

+3
-17
lines changed

libc/src/wchar/CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ add_entrypoint_object(
4343
DEPENDS
4444
libc.hdr.types.size_t
4545
libc.hdr.types.wchar_t
46-
libc.src.__support.wctype_utils
4746
)
4847

4948
add_entrypoint_object(
@@ -54,7 +53,6 @@ add_entrypoint_object(
5453
wcschr.h
5554
DEPENDS
5655
libc.hdr.wchar_macros
57-
libc.src.__support.wctype_utils
5856
)
5957

6058
add_entrypoint_object(
@@ -75,7 +73,6 @@ add_entrypoint_object(
7573
wcspbrk.h
7674
DEPENDS
7775
libc.hdr.wchar_macros
78-
libc.src.__support.wctype_utils
7976
libc.src.__support.macros.null_check
8077
)
8178

@@ -109,7 +106,6 @@ add_entrypoint_object(
109106
DEPENDS
110107
libc.hdr.wchar_macros
111108
libc.hdr.types.size_t
112-
libc.src.__support.wctype_utils
113109
)
114110

115111
add_entrypoint_object(
@@ -121,7 +117,6 @@ add_entrypoint_object(
121117
DEPENDS
122118
libc.hdr.types.size_t
123119
libc.hdr.wchar_macros
124-
libc.src.__support.wctype_utils
125120
libc.src.__support.macros.null_check
126121
)
127122

@@ -134,7 +129,6 @@ add_entrypoint_object(
134129
DEPENDS
135130
libc.hdr.types.size_t
136131
libc.hdr.wchar_macros
137-
libc.src.__support.wctype_utils
138132
)
139133

140134
add_entrypoint_object(
@@ -205,8 +199,6 @@ add_entrypoint_object(
205199
DEPENDS
206200
libc.hdr.types.size_t
207201
libc.hdr.wchar_macros
208-
libc.src.__support.wctype_utils
209-
libc.src.string.memory_utils.inline_memcpy
210202
)
211203

212204
add_entrypoint_object(
@@ -218,6 +210,5 @@ add_entrypoint_object(
218210
DEPENDS
219211
libc.hdr.types.size_t
220212
libc.hdr.wchar_macros
221-
libc.src.string.memory_utils.inline_memcpy
222213
libc.src.string.string_utils
223214
)

libc/src/wchar/wcscpy.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
#include "hdr/types/wchar_t.h"
1313
#include "src/__support/common.h"
1414
#include "src/__support/macros/config.h"
15-
#include "src/string/memory_utils/inline_memcpy.h"
1615
#include "src/string/string_utils.h"
1716

1817
namespace LIBC_NAMESPACE_DECL {
1918

2019
LLVM_LIBC_FUNCTION(wchar_t *, wcscpy,
2120
(wchar_t *__restrict s1, const wchar_t *__restrict s2)) {
2221
size_t size = internal::string_length(s2) + 1;
23-
inline_memcpy(s1, s2, size * sizeof(wchar_t));
22+
__builtin_memcpy(s1, s2, size * sizeof(wchar_t));
2423
return s1;
2524
}
2625

libc/src/wchar/wcsncpy.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#include "hdr/types/wchar_t.h"
1313
#include "src/__support/common.h"
1414
#include "src/__support/macros/config.h"
15-
#include "src/string/memory_utils/inline_memcpy.h"
16-
#include "src/string/string_utils.h"
1715

1816
namespace LIBC_NAMESPACE_DECL {
1917

libc/src/wchar/wmemcpy.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
#include "hdr/types/wchar_t.h"
1313
#include "src/__support/common.h"
1414
#include "src/__support/macros/config.h"
15-
#include "src/string/memory_utils/inline_memcpy.h"
1615

1716
namespace LIBC_NAMESPACE_DECL {
1817

1918
LLVM_LIBC_FUNCTION(wchar_t *, wmemcpy,
2019
(wchar_t *__restrict s1, const wchar_t *__restrict s2,
2120
size_t n)) {
22-
inline_memcpy(s1, s2, n * sizeof(wchar_t));
21+
__builtin_memcpy(s1, s2, n * sizeof(wchar_t));
2322
return s1;
2423
}
2524

libc/src/wchar/wmempcpy.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@
1111
#include "hdr/types/size_t.h"
1212
#include "hdr/types/wchar_t.h"
1313
#include "src/__support/common.h"
14-
#include "src/string/memory_utils/inline_memcpy.h"
1514

1615
namespace LIBC_NAMESPACE_DECL {
1716

1817
LLVM_LIBC_FUNCTION(wchar_t *, wmempcpy,
1918
(wchar_t *__restrict to, const wchar_t *__restrict from,
2019
size_t size)) {
21-
inline_memcpy(to, from, size * sizeof(wchar_t));
20+
__builtin_memcpy(to, from, size * sizeof(wchar_t));
2221
return reinterpret_cast<wchar_t *>(to) + size;
2322
}
2423

0 commit comments

Comments
 (0)