File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
libcudacxx/include/cuda/std/detail/libcxx/include Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -265,13 +265,13 @@ struct _CCCL_TYPE_VISIBILITY_DEFAULT char_traits<char>
265265 {
266266 }
267267#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);))
268+ // nvcc and clang-cuda do not support __builtin_strlen in device code. nvhpc does
269+ // though. this check relies on the fact that nvhpc does not define __CUDA_ARCH__.
270+ # if defined(_CCCL_BUILTIN_STRLEN) && !defined(__CUDA_ARCH__)
271+ return _CCCL_BUILTIN_STRLEN (__s);
272272#else
273273 size_t __len = 0 ;
274- for (; ! eq ( *__s, char ( 0 )); ++__s )
274+ while ( *__s++ )
275275 {
276276 ++__len;
277277 }
You can’t perform that action at this time.
0 commit comments