Support GCC's -Wconversion -Wfloat-conversion -Warith-conversion -Wsign-conversion warnings.

This commit is contained in:
Ion Gaztañaga committed 2021-10-16 15:36:46 +02:00
1 parent 122a84b366
commit 2af840afc1
12 files changed
+281 -167

No files matched your search

+4 -5
View File
@@ -10,7 +10,7 @@ inline unsigned long long rand_15_bit()
{
//Many rand implementation only use 15 bits
//so make sure we have only 15 bits
return (unsigned long long)((std::rand()) & 0x7fffu);
return (unsigned long long)((std::rand()) & 0x7fff);
}
inline unsigned long long ullrand()
@@ -23,10 +23,9 @@ inline unsigned long long ullrand()
template< class RandomIt >
void random_shuffle( RandomIt first, RandomIt last )
{
typedef typename boost::movelib::iterator_traits<RandomIt>::difference_type difference_type;
difference_type n = last - first;
for (difference_type i = n-1; i > 0; --i) {
difference_type j = static_cast<difference_type>(ullrand() % (i+1));
std::size_t n = std::size_t (last - first);
for (std::size_t i = n-1; i > 0; --i) {
std::size_t j = static_cast<std::size_t >(ullrand() % (unsigned long long)(i+1));
if(j != i) {
boost::adl_move_swap(first[i], first[j]);
}
+6 -6
View File
@@ -192,8 +192,8 @@ void test()
reset_counters();
{
bml::unique_ptr<A[]> p(bml::make_unique<A[]>(10));
BOOST_TEST(A::count == 10);
for(int i = 0; i != 10; ++i){
BOOST_TEST(A::count == 10u);
for(std::size_t i = 0; i != 10u; ++i){
BOOST_TEST(p[i].a == 999);
BOOST_TEST(p[i].b == 1000);
BOOST_TEST(p[i].c == 1001);
@@ -202,8 +202,8 @@ void test()
BOOST_TEST(A::count == 0);
{
bml::unique_ptr<A[]> p(bml::make_unique_nothrow<A[]>(10));
BOOST_TEST(A::count == 10);
for(int i = 0; i != 10; ++i){
BOOST_TEST(A::count == 10u);
for(std::size_t i = 0; i != 10u; ++i){
BOOST_TEST(p[i].a == 999);
BOOST_TEST(p[i].b == 1000);
BOOST_TEST(p[i].c == 1001);
@@ -213,14 +213,14 @@ void test()
reset_counters();
{
bml::unique_ptr<default_init[]> p(bml::make_unique_definit<default_init[]>(10));
for(unsigned i = 0; i != 10; ++i){
for(std::size_t i = 0; i != 10u; ++i){
BOOST_TEST(0 == volatile_memcmp(&p[i], ee_patternbuf, sizeof(ee_patternbuf)));
}
}
reset_counters();
{
bml::unique_ptr<default_init[]> p(bml::make_unique_nothrow_definit<default_init[]>(10));
for(unsigned i = 0; i != 10; ++i){
for(std::size_t i = 0; i != 10u; ++i){
BOOST_TEST(0 == volatile_memcmp(&p[i], cc_patternbuf, sizeof(cc_patternbuf)));
}
}