Fix signed conversion warnings.

This commit is contained in:
Daniel James
2016-09-30 09:06:30 +01:00
parent 3dfdb19bfd
commit b0ddb244be
8 changed files with 34 additions and 30 deletions

View File

@@ -179,7 +179,7 @@ namespace boost
hash_float_combine(seed, part);
}
hash_float_combine(seed, exp);
hash_float_combine(seed, static_cast<std::size_t>(exp));
return seed;
}

View File

@@ -84,8 +84,8 @@ void complex_integral_tests(Integer*)
generic_complex_tests(complex(15342,124));
generic_complex_tests(complex(25,54356));
generic_complex_tests(complex(5325,2346));
generic_complex_tests(complex(-243897,-49923874));
generic_complex_tests(complex(-543,763));
generic_complex_tests(complex(Integer(-243897),Integer(-49923874)));
generic_complex_tests(complex(Integer(-543),Integer(763)));
}
int main()

View File

@@ -15,7 +15,7 @@ namespace test
std::size_t hash() const
{
return value_ * 10;
return static_cast<std::size_t>(value_ * 10);
}
#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)

View File

@@ -17,7 +17,7 @@ namespace test
std::size_t hash() const
{
return value_ * 10;
return static_cast<std::size_t>(value_ * 10);
}
#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)

View File

@@ -17,7 +17,7 @@ struct custom
std::size_t hash() const
{
return value_ * 10;
return static_cast<std::size_t>(value_ * 10);
}
#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)

View File

@@ -19,6 +19,8 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
template <class T>
void integer_tests(T* = 0)
{
typedef typename T::value_type value_type;
const int number_of_containers = 11;
T containers[number_of_containers];
@@ -27,16 +29,16 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
containers[i].push_back(0);
}
containers[5].push_back(1);
containers[6].push_back(1);
containers[6].push_back(1);
containers[7].push_back(-1);
containers[8].push_back(-1);
containers[8].push_back(-1);
containers[9].push_back(1);
containers[9].push_back(-1);
containers[10].push_back(-1);
containers[10].push_back(1);
containers[5].push_back(value_type(1));
containers[6].push_back(value_type(1));
containers[6].push_back(value_type(1));
containers[7].push_back(value_type(-1));
containers[8].push_back(value_type(-1));
containers[8].push_back(value_type(-1));
containers[9].push_back(value_type(1));
containers[9].push_back(value_type(-1));
containers[10].push_back(value_type(-1));
containers[10].push_back(value_type(1));
BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;

View File

@@ -19,6 +19,8 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
template <class T>
void integer_tests(T* = 0)
{
typedef typename T::value_type value_type;
const int number_of_containers = 12;
T containers[number_of_containers];
@@ -27,19 +29,19 @@ namespace BOOST_PP_CAT(CONTAINER_TYPE, _tests)
containers[i].insert(0);
}
containers[6].insert(1);
containers[7].insert(1);
containers[7].insert(1);
containers[8].insert(-1);
containers[9].insert(-1);
containers[9].insert(-1);
containers[10].insert(-1);
containers[10].insert(1);
containers[11].insert(1);
containers[11].insert(2);
containers[11].insert(3);
containers[11].insert(4);
containers[11].insert(5);
containers[6].insert(value_type(1));
containers[7].insert(value_type(1));
containers[7].insert(value_type(1));
containers[8].insert(value_type(-1));
containers[9].insert(value_type(-1));
containers[9].insert(value_type(-1));
containers[10].insert(value_type(-1));
containers[10].insert(value_type(1));
containers[11].insert(value_type(1));
containers[11].insert(value_type(2));
containers[11].insert(value_type(3));
containers[11].insert(value_type(4));
containers[11].insert(value_type(5));
BOOST_HASH_TEST_NAMESPACE::hash<T> hasher;

View File

@@ -20,7 +20,7 @@ int f(std::size_t hash1, int* x1) {
// Check that std::vector<std::size_t> is avaiable in this file.
std::vector<std::size_t> x;
x.push_back(*x1);
x.push_back(static_cast<std::size_t>(*x1));
BOOST_HASH_TEST_NAMESPACE::hash<std::vector<std::size_t> > vector_hasher;
return vector_hasher(x) != BOOST_HASH_TEST_NAMESPACE::hash_value(x);