We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
NV_IF_TARGET
char_traits<char>::length
1 parent 454eb23 commit bb86c71Copy full SHA for bb86c71
libcudacxx/include/cuda/std/detail/libcxx/include/__string
@@ -265,13 +265,13 @@ struct _CCCL_TYPE_VISIBILITY_DEFAULT char_traits<char>
265
{
266
}
267
#endif
268
-#if defined(_CCCL_BUILTIN_STRLEN)
269
- NV_IF_ELSE_TARGET(NV_IS_DEVICE,
270
- (size_t __len = 0; for (; !eq(*__s, char(0)); ++__s)++ __len; return __len;),
271
- (return _CCCL_BUILTIN_STRLEN(__s);))
+ // nvcc and clang-cuda do not support __builtin_strlen in device code. nvhpc does
+ // though. this check relies on the fact that nvhpc does not define __CUDA_ARCH__.
+#if defined(_CCCL_BUILTIN_STRLEN) && !defined(__CUDA_ARCH__)
+ return _CCCL_BUILTIN_STRLEN(__s);
272
#else
273
size_t __len = 0;
274
- for (; !eq(*__s, char(0)); ++__s)
+ while (*__s++)
275
276
++__len;
277
0 commit comments