Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
miscco committed Aug 19, 2024
1 parent ca3e319 commit 7c65c9c
Showing 1 changed file with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "test_macros.h"

__host__ __device__ cuda::std::size_t memcmp(void* lhs, void* rhs, size_t bytes) noexcept
__host__ __device__ cuda::std::size_t test_memcmp(void* lhs, void* rhs, size_t bytes) noexcept
{
const unsigned char* clhs = (const unsigned char*) lhs;
const unsigned char* crhs = (const unsigned char*) rhs;
Expand Down Expand Up @@ -54,9 +54,9 @@ __host__ __device__ void test_roundtrip_through_buffer(T from)

_CCCL_IF_CONSTEXPR (HasUniqueObjectRepresentations)
{
assert(memcmp(&from, &middle, sizeof(T)) == 0);
assert(memcmp(&to, &middle, sizeof(T)) == 0);
assert(memcmp(&middle, &middle2, sizeof(T)) == 0);
assert(test_memcmp(&from, &middle, sizeof(T)) == 0);
assert(test_memcmp(&to, &middle, sizeof(T)) == 0);
assert(test_memcmp(&middle, &middle2, sizeof(T)) == 0);
}
}

Expand All @@ -77,14 +77,13 @@ __host__ __device__ void test_roundtrip_through_nested_T(T from)

_CCCL_IF_CONSTEXPR (HasUniqueObjectRepresentations)
{
assert(memcmp(&from, &middle, sizeof(T)) == 0);
assert(memcmp(&to, &middle, sizeof(T)) == 0);
assert(memcmp(&middle, &middle2, sizeof(T)) == 0);
assert(test_memcmp(&from, &middle, sizeof(T)) == 0);
assert(test_memcmp(&to, &middle, sizeof(T)) == 0);
assert(test_memcmp(&middle, &middle2, sizeof(T)) == 0);
}
}

template <typename Intermediate, bool HasUniqueObjectRepresentations = true, typename T>

__host__ __device__ void test_roundtrip_through(T from)
{
static_assert(sizeof(Intermediate) == sizeof(T));
Expand All @@ -97,14 +96,13 @@ __host__ __device__ void test_roundtrip_through(T from)

_CCCL_IF_CONSTEXPR (HasUniqueObjectRepresentations)
{
assert(memcmp(&from, &middle, sizeof(T)) == 0);
assert(memcmp(&to, &middle, sizeof(T)) == 0);
assert(memcmp(&middle, &middle2, sizeof(T)) == 0);
assert(test_memcmp(&from, &middle, sizeof(T)) == 0);
assert(test_memcmp(&to, &middle, sizeof(T)) == 0);
assert(test_memcmp(&middle, &middle2, sizeof(T)) == 0);
}
}

template <typename T>

__host__ __device__ _LIBCUDACXX_CONSTEXPR_BIT_CAST cuda::std::array<T, 10> generate_signed_integral_values()
{
return {cuda::std::numeric_limits<T>::min(),
Expand All @@ -120,7 +118,6 @@ __host__ __device__ _LIBCUDACXX_CONSTEXPR_BIT_CAST cuda::std::array<T, 10> gener
}

template <typename T>

__host__ __device__ _LIBCUDACXX_CONSTEXPR_BIT_CAST cuda::std::array<T, 6> generate_unsigned_integral_values()
{
return {static_cast<T>(0),
Expand Down Expand Up @@ -266,7 +263,8 @@ __host__ __device__ bool tests()
cuda::std::nanf(""),
__builtin_nanf("0x55550001"), // NaN with a payload
cuda::std::numeric_limits<float>::signaling_NaN(),
cuda::std::numeric_limits<float>::quiet_NaN()})
cuda::std::numeric_limits<float>::quiet_NaN(),
cuda::std::numeric_limits<float>::infinity()})
{
test_roundtrip_through_nested_T(i);
test_roundtrip_through_buffer(i);
Expand All @@ -287,7 +285,8 @@ __host__ __device__ bool tests()
3.141592653589793238462643383279502884197169399375105820974944,
cuda::std::nan(""),
cuda::std::numeric_limits<double>::signaling_NaN(),
cuda::std::numeric_limits<double>::quiet_NaN()})
cuda::std::numeric_limits<double>::quiet_NaN(),
cuda::std::numeric_limits<double>::infinity()})
{
test_roundtrip_through_nested_T(i);
test_roundtrip_through_buffer(i);
Expand Down

0 comments on commit 7c65c9c

Please sign in to comment.