Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1530 from matt-stack/bug/github/wconversion-1478
Browse files Browse the repository at this point in the history
First checkpoint for Wconversion warning fixes
  • Loading branch information
alliepiper authored Oct 6, 2021
2 parents f50f80e + 114344d commit 04f3895
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion thrust/detail/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ template<typename T1, typename T2>

template<typename T> static typename add_reference<T>::type declval();

template<unsigned int> struct helper { typedef void * type; };
template<size_t> struct helper { typedef void * type; };

template<typename U1, typename U2> static yes_type test(typename helper<sizeof(declval<U1>() = declval<U2>())>::type);

Expand Down
2 changes: 1 addition & 1 deletion thrust/system/cuda/detail/adjacent_difference.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace __adjacent_difference {
{
enum
{
INPUT_SIZE = sizeof(T),
INPUT_SIZE = static_cast<int>(sizeof(T)),
NOMINAL_4B_ITEMS_PER_THREAD = 7,
ITEMS_PER_THREAD = items_per_thread<INPUT_SIZE,
NOMINAL_4B_ITEMS_PER_THREAD>::value
Expand Down
6 changes: 3 additions & 3 deletions thrust/system/cuda/detail/merge.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace __merge {

namespace mpl = thrust::detail::mpl::math;

template<size_t NOMINAL_4B_ITEMS_PER_THREAD, size_t INPUT_SIZE>
template<int NOMINAL_4B_ITEMS_PER_THREAD, size_t INPUT_SIZE>
struct items_per_thread
{
enum
Expand All @@ -201,8 +201,8 @@ namespace __merge {
mpl::max<
int,
1,
(NOMINAL_4B_ITEMS_PER_THREAD * 4 / INPUT_SIZE)>::value>::value,
value = mpl::is_odd<size_t, ITEMS_PER_THREAD>::value
static_cast<int>(NOMINAL_4B_ITEMS_PER_THREAD * 4 / INPUT_SIZE)>::value>::value,
value = mpl::is_odd<int, ITEMS_PER_THREAD>::value
? ITEMS_PER_THREAD
: ITEMS_PER_THREAD + 1
};
Expand Down
4 changes: 2 additions & 2 deletions thrust/system/cuda/detail/reduce_by_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ namespace __reduce_by_key {
mpl::max<
int,
1,
((NOMINAL_4B_ITEMS_PER_THREAD * 8) +
static_cast<int>(((NOMINAL_4B_ITEMS_PER_THREAD * 8) +
COMBINED_INPUT_BYTES - 1) /
COMBINED_INPUT_BYTES>::value>::value,
COMBINED_INPUT_BYTES)>::value>::value,
};

typedef PtxPolicy<128,
Expand Down
4 changes: 2 additions & 2 deletions thrust/system/cuda/detail/scan_by_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ namespace __scan_by_key {
int,
1,
((NOMINAL_4B_ITEMS_PER_THREAD * 8) +
COMBINED_INPUT_BYTES - 1) /
COMBINED_INPUT_BYTES>::value>::value,
static_cast<int>(COMBINED_INPUT_BYTES) - 1) /
static_cast<int>(COMBINED_INPUT_BYTES)>::value>::value,
};

typedef PtxPolicy<128,
Expand Down
12 changes: 6 additions & 6 deletions thrust/system/cuda/detail/set_operations.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ namespace __set_operations {
mpl::max<
int,
1,
((NOMINAL_4B_ITEMS_PER_THREAD * 4) +
static_cast<int>(((NOMINAL_4B_ITEMS_PER_THREAD * 4) +
COMBINED_INPUT_BYTES - 1) /
COMBINED_INPUT_BYTES>::value>::value,
COMBINED_INPUT_BYTES)>::value>::value,
};

typedef PtxPolicy<128,
Expand All @@ -266,9 +266,9 @@ namespace __set_operations {
mpl::max<
int,
1,
((NOMINAL_4B_ITEMS_PER_THREAD * 4) +
static_cast<int>(((NOMINAL_4B_ITEMS_PER_THREAD * 4) +
COMBINED_INPUT_BYTES - 1) /
COMBINED_INPUT_BYTES>::value>::value,
COMBINED_INPUT_BYTES)>::value>::value,
};

typedef PtxPolicy<256,
Expand All @@ -293,9 +293,9 @@ namespace __set_operations {
mpl::max<
int,
1,
((NOMINAL_4B_ITEMS_PER_THREAD * 4) +
static_cast<int>(((NOMINAL_4B_ITEMS_PER_THREAD * 4) +
COMBINED_INPUT_BYTES - 1) /
COMBINED_INPUT_BYTES>::value>::value,
COMBINED_INPUT_BYTES)>::value>::value,
};

typedef PtxPolicy<512,
Expand Down
4 changes: 2 additions & 2 deletions thrust/system/cuda/detail/unique.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace __unique {

namespace mpl = thrust::detail::mpl::math;

template<class T, size_t NOMINAL_4B_ITEMS_PER_THREAD>
template<class T, int NOMINAL_4B_ITEMS_PER_THREAD>
struct items_per_thread
{
enum
Expand All @@ -109,7 +109,7 @@ namespace __unique {
NOMINAL_4B_ITEMS_PER_THREAD,
mpl::max<int,
1,
(NOMINAL_4B_ITEMS_PER_THREAD * 4 /
static_cast<int>(NOMINAL_4B_ITEMS_PER_THREAD * 4 /
sizeof(T))>::value>::value
};
};
Expand Down
6 changes: 3 additions & 3 deletions thrust/system/cuda/detail/unique_by_key.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ namespace __unique_by_key {
{
value = mpl::min<
int,
NOMINAL_4B_ITEMS_PER_THREAD,
static_cast<int>(NOMINAL_4B_ITEMS_PER_THREAD),
mpl::max<int,
1,
(NOMINAL_4B_ITEMS_PER_THREAD * 4 /
sizeof(T))>::value>::value
static_cast<int>(NOMINAL_4B_ITEMS_PER_THREAD * 4 /
sizeof(T))>::value>::value
};
};

Expand Down
6 changes: 3 additions & 3 deletions thrust/system/detail/sequential/stable_radix_sort.inl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ struct RadixEncoder<char> : public thrust::unary_function<char, unsigned char>
{
if(std::numeric_limits<char>::is_signed)
{
return x ^ static_cast<unsigned char>(1) << (8 * sizeof(unsigned char) - 1);
return static_cast<unsigned char>(x) ^ static_cast<unsigned char>(1) << (8 * sizeof(unsigned char) - 1);
}
else
{
Expand All @@ -66,7 +66,7 @@ struct RadixEncoder<signed char> : public thrust::unary_function<signed char, un
__host__ __device__
unsigned char operator()(signed char x) const
{
return x ^ static_cast<unsigned char>(1) << (8 * sizeof(unsigned char) - 1);
return static_cast<unsigned char>(x) ^ static_cast<unsigned char>(1) << (8 * sizeof(unsigned char) - 1);
}
};

Expand All @@ -76,7 +76,7 @@ struct RadixEncoder<short> : public thrust::unary_function<short, unsigned short
__host__ __device__
unsigned short operator()(short x) const
{
return x ^ static_cast<unsigned short>(1) << (8 * sizeof(unsigned short) - 1);
return static_cast<unsigned short>(x) ^ static_cast<unsigned short>(1) << (8 * sizeof(unsigned short) - 1);
}
};

Expand Down

0 comments on commit 04f3895

Please sign in to comment.