Skip to content

fix(ustring): fix Cuda warnings #3978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/include/OpenImageIO/ustring.h
Original file line number Diff line number Diff line change
Expand Up @@ -816,41 +816,41 @@ class OIIO_UTIL_API ustringhash {

/// Construct a ustringhash from a null-terminated C string (char *).
OIIO_DEVICE_CONSTEXPR explicit ustringhash(const char* str)
{
#ifdef __CUDA_ARCH__
// GPU: just compute the hash. This can be constexpr!
m_hash = Strutil::strhash(str);
: m_hash(Strutil::strhash(str))
#else
// CPU: make ustring, get its hash. Note that ustring ctr can't be
// constexpr because it has to modify the internal ustring table.
m_hash = ustring(str).hash();
: m_hash(ustring(str).hash())
#endif
{
}

OIIO_DEVICE_CONSTEXPR explicit ustringhash(const char* str, size_t len)
{
#ifdef __CUDA_ARCH__
// GPU: just compute the hash. This can be constexpr!
m_hash = Strutil::strhash(len, str);
: m_hash(Strutil::strhash(len, str))
#else
// CPU: make ustring, get its hash. Note that ustring ctr can't be
// constexpr because it has to modify the internal ustring table.
m_hash = ustring(str, len).hash();
: m_hash(ustring(str, len).hash())
#endif
{
}

/// Construct a ustringhash from a string_view, which can be
/// auto-converted from either a std::string.
OIIO_DEVICE_CONSTEXPR explicit ustringhash(string_view str)
{
#ifdef __CUDA_ARCH__
// GPU: just compute the hash. This can be constexpr!
m_hash = Strutil::strhash(str);
: m_hash(Strutil::strhash(str))
#else
// CPU: make ustring, get its hash. Note that ustring ctr can't be
// constexpr because it has to modify the internal ustring table.
m_hash = ustring(str).hash();
: m_hash(ustring(str).hash())
#endif
{
}

/// Construct from a raw hash value. Beware: results are undefined if it's
Expand Down