1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
//===----------------------------------------------------------------------===//
//
// Part of libcu++, the C++ Standard Library for your entire system,
// under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//
#ifndef _CUDA_STD_CSTRING
#define _CUDA_STD_CSTRING
#include <cuda/std/detail/__config>
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
# pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
# pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
# pragma system_header
#endif // no system header
#include <cuda/std/__string/constexpr_c_functions.h>
#if !_CCCL_COMPILER(NVRTC)
# include <cstring>
#endif // !_CCCL_COMPILER(NVRTC)
#include <cuda/std/__cccl/prologue.h>
_LIBCUDACXX_BEGIN_NAMESPACE_STD
using ::memcpy;
using ::memset;
using ::size_t;
_CCCL_API constexpr char* strcpy(char* _CCCL_RESTRICT __dst, const char* _CCCL_RESTRICT __src)
{
return _CUDA_VSTD::__cccl_strcpy(__dst, __src);
}
_CCCL_API constexpr char* strncpy(char* _CCCL_RESTRICT __dst, const char* _CCCL_RESTRICT __src, size_t __n)
{
return _CUDA_VSTD::__cccl_strncpy(__dst, __src, __n);
}
[[nodiscard]] _CCCL_API constexpr size_t strlen(const char* __ptr)
{
return _CUDA_VSTD::__cccl_strlen(__ptr);
}
[[nodiscard]] _CCCL_API constexpr int strcmp(const char* __lhs, const char* __rhs)
{
return _CUDA_VSTD::__cccl_strcmp(__lhs, __rhs);
}
[[nodiscard]] _CCCL_API constexpr int strncmp(const char* __lhs, const char* __rhs, size_t __n)
{
return _CUDA_VSTD::__cccl_strncmp(__lhs, __rhs, __n);
}
[[nodiscard]] _CCCL_API constexpr const char* strchr(const char* __ptr, int __c)
{
return _CUDA_VSTD::__cccl_strchr<const char>(__ptr, static_cast<char>(__c));
}
[[nodiscard]] _CCCL_API constexpr char* strchr(char* __ptr, int __c)
{
return _CUDA_VSTD::__cccl_strchr(__ptr, static_cast<char>(__c));
}
[[nodiscard]] _CCCL_API constexpr const char* strrchr(const char* __ptr, int __c)
{
return _CUDA_VSTD::__cccl_strrchr<const char>(__ptr, static_cast<char>(__c));
}
[[nodiscard]] _CCCL_API constexpr char* strrchr(char* __ptr, int __c)
{
return _CUDA_VSTD::__cccl_strrchr(__ptr, static_cast<char>(__c));
}
_CCCL_API inline const void* memchr(const void* __ptr, int __c, size_t __n) noexcept
{
return _CUDA_VSTD::__cccl_memchr<const unsigned char>(
reinterpret_cast<const unsigned char*>(__ptr), static_cast<unsigned char>(__c), __n);
}
_CCCL_API inline void* memchr(void* __ptr, int __c, size_t __n) noexcept
{
return _CUDA_VSTD::__cccl_memchr(reinterpret_cast<unsigned char*>(__ptr), static_cast<unsigned char>(__c), __n);
}
_CCCL_API inline void* memmove(void* __dst, const void* __src, size_t __n) noexcept
{
return _CUDA_VSTD::__cccl_memmove(
reinterpret_cast<unsigned char*>(__dst), reinterpret_cast<const unsigned char*>(__src), __n);
}
[[nodiscard]] _CCCL_API inline int memcmp(const void* __lhs, const void* __rhs, size_t __n) noexcept
{
return _CUDA_VSTD::__cccl_memcmp(
reinterpret_cast<const unsigned char*>(__lhs), reinterpret_cast<const unsigned char*>(__rhs), __n);
}
_LIBCUDACXX_END_NAMESPACE_STD
#include <cuda/std/__cccl/epilogue.h>
#endif // _CUDA_STD_CSTRING
|