|
Boost-Commit : |
From: zeux_at_[hidden]
Date: 2007-06-11 19:27:46
Author: zeux
Date: 2007-06-11 19:27:45 EDT (Mon, 11 Jun 2007)
New Revision: 6983
URL: http://svn.boost.org/trac/boost/changeset/6983
Log:
Fixed GCC warnings and errors
Text files modified:
sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp | 21 ++--
sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp | 4
sandbox/SOC/2007/bigint/libs/bigint/test/arithmetics.cpp | 12 +-
sandbox/SOC/2007/bigint/libs/bigint/test/can_convert_to.cpp | 186 ++++++++++++++++++++--------------------
sandbox/SOC/2007/bigint/libs/bigint/test/comparison.cpp | 8
sandbox/SOC/2007/bigint/libs/bigint/test/number_conversion.cpp | 16 +-
sandbox/SOC/2007/bigint/libs/bigint/test/stream.cpp | 30 ++++++
sandbox/SOC/2007/bigint/libs/bigint/todo.txt | 6
8 files changed, 155 insertions(+), 128 deletions(-)
Modified: sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp
==============================================================================
--- sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp (original)
+++ sandbox/SOC/2007/bigint/boost/bigint/bigint.hpp 2007-06-11 19:27:45 EDT (Mon, 11 Jun 2007)
@@ -391,7 +391,7 @@
template <typename T, typename Tr> friend std::basic_ostream<T, Tr>& operator<<(std::basic_ostream<T, Tr>& lhs, const bigint_base& rhs)
{
- std::basic_ostream<T, Tr>::sentry ok(lhs);
+ typename std::basic_ostream<T, Tr>::sentry ok(lhs);
if (ok)
{
@@ -409,7 +409,7 @@
if (uppercase && base == 16) std::transform(str.begin(), str.end(), str.begin(), detail::bigint::toupper());
- std::string::size_type pad_length = 0;
+ typename std::basic_string<T>::size_type pad_length = 0;
// str[0] is safe, to_string will never return empty string
if (showpos && str[0] != '-')
@@ -427,8 +427,8 @@
{
std::basic_string<T> nstr;
- std::basic_string<T>::reverse_iterator it = str.rbegin();
- std::basic_string<T>::reverse_iterator end = str.rend();
+ typename std::basic_string<T>::reverse_iterator it = str.rbegin();
+ typename std::basic_string<T>::reverse_iterator end = str.rend();
if (pad_length > 0) --end; // skip sign
size_t group_id = 0;
@@ -480,7 +480,7 @@
{
std::ios_base::fmtflags adjustfield = flags & std::ios_base::adjustfield;
- std::string::size_type pad_pos = 0; // pad before
+ typename std::basic_string<T>::size_type pad_pos = 0; // pad before
if (adjustfield == std::ios_base::left) pad_pos = str.length();
else if (adjustfield == std::ios_base::internal) pad_pos = pad_length;
@@ -502,7 +502,7 @@
template <typename T, typename Tr> friend std::basic_istream<T, Tr>& operator>>(std::basic_istream<T, Tr>& lhs, bigint_base& rhs)
{
- std::basic_istream<T, Tr>::sentry ok(lhs);
+ typename std::basic_istream<T, Tr>::sentry ok(lhs);
if (ok)
{
@@ -552,7 +552,7 @@
const std::numpunct<T>& punct = std::use_facet<std::numpunct<T> >(lhs.getloc());
- Tr::int_type ch;
+ typename Tr::int_type ch;
while ((ch = lhs.peek()) != Tr::eof())
{
@@ -579,17 +579,16 @@
if (!grouping.empty())
{
- std::basic_string<T>::reverse_iterator it = str.rbegin();
- std::basic_string<T>::reverse_iterator end = str.rend();
+ typename std::basic_string<T>::reverse_iterator it = str.rbegin();
+ typename std::basic_string<T>::reverse_iterator end = str.rend();
size_t group_id = 0;
- size_t chars_to_go = str.size();
while (it != end)
{
char limit = group_id >= grouping.size() ? (grouping.empty() ? 0 : grouping[grouping.size() - 1]) : grouping[group_id];
- std::basic_string<T>::reverse_iterator sep_it = std::find(it, end, punct.thousands_sep());
+ typename std::basic_string<T>::reverse_iterator sep_it = std::find(it, end, punct.thousands_sep());
if (limit <= 0) // unlimited sequence of digits
{
Modified: sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp
==============================================================================
--- sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp (original)
+++ sandbox/SOC/2007/bigint/boost/bigint/bigint_gmp.hpp 2007-06-11 19:27:45 EDT (Mon, 11 Jun 2007)
@@ -138,7 +138,7 @@
for (size_t i = 0; i < d_size; ++i)
{
- if (*str < 0 || *str > 127 || digit_value_tab[static_cast<unsigned int>(*str)] >= base)
+ if (static_cast<int>(*str) < 0 || static_cast<int>(*str) > 127 || digit_value_tab[static_cast<unsigned int>(*str)] >= base)
{
d_size = i;
break;
@@ -337,7 +337,7 @@
max_value = (std::numeric_limits<T>::max)();
}
- if (count * GMP_NUMB_BITS > sizeof(boost::uint64_t) * 8) // we can't fit in uint64 => we won't fit in anything else
+ if (static_cast<size_t>(count) * GMP_NUMB_BITS > sizeof(boost::uint64_t) * 8) // we can't fit in uint64 => we won't fit in anything else
return false;
return max_value >= _to_uint64();
Modified: sandbox/SOC/2007/bigint/libs/bigint/test/arithmetics.cpp
==============================================================================
--- sandbox/SOC/2007/bigint/libs/bigint/test/arithmetics.cpp (original)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/arithmetics.cpp 2007-06-11 19:27:45 EDT (Mon, 11 Jun 2007)
@@ -236,22 +236,22 @@
\
BOOST_CHECK_EQUAL(d, c); \
\
- if (a.can_convert_to<boost::int64_t>()) \
+ if (a.template can_convert_to<boost::int64_t>()) \
{ \
- BOOST_CHECK_EQUAL(a.to_number<boost::int64_t>() op b, c); \
+ BOOST_CHECK_EQUAL(a.template to_number<boost::int64_t>() op b, c); \
} \
\
- if (b.can_convert_to<boost::int64_t>()) \
+ if (b.template can_convert_to<boost::int64_t>()) \
{ \
- BOOST_CHECK_EQUAL(a op b.to_number<boost::int64_t>(), c); \
+ BOOST_CHECK_EQUAL(a op b.template to_number<boost::int64_t>(), c); \
} \
} break
#define GEN_SOP(op, chop) case chop: \
{ \
- if (b.can_convert_to<boost::uint64_t>()) \
+ if (b.template can_convert_to<boost::uint64_t>()) \
{ \
- boost::uint64_t ub = b.to_number<boost::uint64_t>(); \
+ boost::uint64_t ub = b.template to_number<boost::uint64_t>(); \
\
BOOST_CHECK_EQUAL(a op ub, c); \
\
Modified: sandbox/SOC/2007/bigint/libs/bigint/test/can_convert_to.cpp
==============================================================================
--- sandbox/SOC/2007/bigint/libs/bigint/test/can_convert_to.cpp (original)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/can_convert_to.cpp 2007-06-11 19:27:45 EDT (Mon, 11 Jun 2007)
@@ -20,130 +20,130 @@
typedef boost::bigint_base<I> number;
// char
- BOOST_CHECK(!number("-129").can_convert_to<char>());
- BOOST_CHECK( number("-128").can_convert_to<char>());
- BOOST_CHECK( number("-127").can_convert_to<char>());
-
- BOOST_CHECK( number("-1").can_convert_to<char>());
- BOOST_CHECK( number("0").can_convert_to<char>());
- BOOST_CHECK( number("1").can_convert_to<char>());
-
- BOOST_CHECK( number("127").can_convert_to<char>());
- BOOST_CHECK(!number("128").can_convert_to<char>());
- BOOST_CHECK(!number("129").can_convert_to<char>());
+ BOOST_CHECK(!number("-129").template can_convert_to<char>());
+ BOOST_CHECK( number("-128").template can_convert_to<char>());
+ BOOST_CHECK( number("-127").template can_convert_to<char>());
+
+ BOOST_CHECK( number("-1").template can_convert_to<char>());
+ BOOST_CHECK( number("0").template can_convert_to<char>());
+ BOOST_CHECK( number("1").template can_convert_to<char>());
+
+ BOOST_CHECK( number("127").template can_convert_to<char>());
+ BOOST_CHECK(!number("128").template can_convert_to<char>());
+ BOOST_CHECK(!number("129").template can_convert_to<char>());
// unsigned char
- BOOST_CHECK(!number("-12930").can_convert_to<unsigned char>());
- BOOST_CHECK(!number("-1").can_convert_to<unsigned char>());
+ BOOST_CHECK(!number("-12930").template can_convert_to<unsigned char>());
+ BOOST_CHECK(!number("-1").template can_convert_to<unsigned char>());
- BOOST_CHECK( number("0").can_convert_to<unsigned char>());
- BOOST_CHECK( number("1").can_convert_to<unsigned char>());
+ BOOST_CHECK( number("0").template can_convert_to<unsigned char>());
+ BOOST_CHECK( number("1").template can_convert_to<unsigned char>());
- BOOST_CHECK( number("127").can_convert_to<unsigned char>());
- BOOST_CHECK( number("128").can_convert_to<unsigned char>());
- BOOST_CHECK( number("129").can_convert_to<unsigned char>());
+ BOOST_CHECK( number("127").template can_convert_to<unsigned char>());
+ BOOST_CHECK( number("128").template can_convert_to<unsigned char>());
+ BOOST_CHECK( number("129").template can_convert_to<unsigned char>());
- BOOST_CHECK( number("255").can_convert_to<unsigned char>());
- BOOST_CHECK(!number("256").can_convert_to<unsigned char>());
+ BOOST_CHECK( number("255").template can_convert_to<unsigned char>());
+ BOOST_CHECK(!number("256").template can_convert_to<unsigned char>());
// short
- BOOST_CHECK(!number("-32769").can_convert_to<short>());
- BOOST_CHECK( number("-32768").can_convert_to<short>());
- BOOST_CHECK( number("-32767").can_convert_to<short>());
-
- BOOST_CHECK( number("-1").can_convert_to<short>());
- BOOST_CHECK( number("0").can_convert_to<short>());
- BOOST_CHECK( number("1").can_convert_to<short>());
-
- BOOST_CHECK( number("32767").can_convert_to<short>());
- BOOST_CHECK(!number("32768").can_convert_to<short>());
- BOOST_CHECK(!number("32769").can_convert_to<short>());
+ BOOST_CHECK(!number("-32769").template can_convert_to<short>());
+ BOOST_CHECK( number("-32768").template can_convert_to<short>());
+ BOOST_CHECK( number("-32767").template can_convert_to<short>());
+
+ BOOST_CHECK( number("-1").template can_convert_to<short>());
+ BOOST_CHECK( number("0").template can_convert_to<short>());
+ BOOST_CHECK( number("1").template can_convert_to<short>());
+
+ BOOST_CHECK( number("32767").template can_convert_to<short>());
+ BOOST_CHECK(!number("32768").template can_convert_to<short>());
+ BOOST_CHECK(!number("32769").template can_convert_to<short>());
// unsigned short
- BOOST_CHECK(!number("-12930").can_convert_to<unsigned short>());
- BOOST_CHECK(!number("-1").can_convert_to<unsigned short>());
+ BOOST_CHECK(!number("-12930").template can_convert_to<unsigned short>());
+ BOOST_CHECK(!number("-1").template can_convert_to<unsigned short>());
- BOOST_CHECK( number("0").can_convert_to<unsigned short>());
- BOOST_CHECK( number("1").can_convert_to<unsigned short>());
+ BOOST_CHECK( number("0").template can_convert_to<unsigned short>());
+ BOOST_CHECK( number("1").template can_convert_to<unsigned short>());
- BOOST_CHECK( number("32767").can_convert_to<unsigned short>());
- BOOST_CHECK( number("32768").can_convert_to<unsigned short>());
- BOOST_CHECK( number("32769").can_convert_to<unsigned short>());
+ BOOST_CHECK( number("32767").template can_convert_to<unsigned short>());
+ BOOST_CHECK( number("32768").template can_convert_to<unsigned short>());
+ BOOST_CHECK( number("32769").template can_convert_to<unsigned short>());
- BOOST_CHECK( number("65535").can_convert_to<unsigned short>());
- BOOST_CHECK(!number("65536").can_convert_to<unsigned short>());
+ BOOST_CHECK( number("65535").template can_convert_to<unsigned short>());
+ BOOST_CHECK(!number("65536").template can_convert_to<unsigned short>());
// int
- BOOST_CHECK(!number("-80000001", 16).can_convert_to<int>());
- BOOST_CHECK( number("-80000000", 16).can_convert_to<int>());
- BOOST_CHECK( number("-7fffffff", 16).can_convert_to<int>());
+ BOOST_CHECK(!number("-80000001", 16).template can_convert_to<int>());
+ BOOST_CHECK( number("-80000000", 16).template can_convert_to<int>());
+ BOOST_CHECK( number("-7fffffff", 16).template can_convert_to<int>());
- BOOST_CHECK( number("-1").can_convert_to<int>());
- BOOST_CHECK( number("0").can_convert_to<int>());
- BOOST_CHECK( number("1").can_convert_to<int>());
-
- BOOST_CHECK( number("7fffffff", 16).can_convert_to<int>());
- BOOST_CHECK(!number("80000000", 16).can_convert_to<int>());
- BOOST_CHECK(!number("80000001", 16).can_convert_to<int>());
+ BOOST_CHECK( number("-1").template can_convert_to<int>());
+ BOOST_CHECK( number("0").template can_convert_to<int>());
+ BOOST_CHECK( number("1").template can_convert_to<int>());
+
+ BOOST_CHECK( number("7fffffff", 16).template can_convert_to<int>());
+ BOOST_CHECK(!number("80000000", 16).template can_convert_to<int>());
+ BOOST_CHECK(!number("80000001", 16).template can_convert_to<int>());
// unsigned int
- BOOST_CHECK(!number("-12930").can_convert_to<unsigned int>());
- BOOST_CHECK(!number("-1").can_convert_to<unsigned int>());
+ BOOST_CHECK(!number("-12930").template can_convert_to<unsigned int>());
+ BOOST_CHECK(!number("-1").template can_convert_to<unsigned int>());
- BOOST_CHECK( number("0").can_convert_to<unsigned int>());
- BOOST_CHECK( number("1").can_convert_to<unsigned int>());
+ BOOST_CHECK( number("0").template can_convert_to<unsigned int>());
+ BOOST_CHECK( number("1").template can_convert_to<unsigned int>());
- BOOST_CHECK( number("7fffffff", 16).can_convert_to<unsigned int>());
- BOOST_CHECK( number("80000000", 16).can_convert_to<unsigned int>());
- BOOST_CHECK( number("80000001", 16).can_convert_to<unsigned int>());
+ BOOST_CHECK( number("7fffffff", 16).template can_convert_to<unsigned int>());
+ BOOST_CHECK( number("80000000", 16).template can_convert_to<unsigned int>());
+ BOOST_CHECK( number("80000001", 16).template can_convert_to<unsigned int>());
- BOOST_CHECK( number("ffffffff", 16).can_convert_to<unsigned int>());
- BOOST_CHECK(!number("100000000", 16).can_convert_to<unsigned int>());
+ BOOST_CHECK( number("ffffffff", 16).template can_convert_to<unsigned int>());
+ BOOST_CHECK(!number("100000000", 16).template can_convert_to<unsigned int>());
// int64_t
- BOOST_CHECK(!number("-8000000000000001", 16).can_convert_to<boost::int64_t>());
- BOOST_CHECK( number("-8000000000000000", 16).can_convert_to<boost::int64_t>());
- BOOST_CHECK( number("-7fffffffffffffff", 16).can_convert_to<boost::int64_t>());
+ BOOST_CHECK(!number("-8000000000000001", 16).template can_convert_to<boost::int64_t>());
+ BOOST_CHECK( number("-8000000000000000", 16).template can_convert_to<boost::int64_t>());
+ BOOST_CHECK( number("-7fffffffffffffff", 16).template can_convert_to<boost::int64_t>());
- BOOST_CHECK( number("-80000001", 16).can_convert_to<boost::int64_t>());
- BOOST_CHECK( number("-80000000", 16).can_convert_to<boost::int64_t>());
- BOOST_CHECK( number("-7fffffff", 16).can_convert_to<boost::int64_t>());
-
- BOOST_CHECK( number("-1").can_convert_to<boost::int64_t>());
- BOOST_CHECK( number("0").can_convert_to<boost::int64_t>());
- BOOST_CHECK( number("1").can_convert_to<boost::int64_t>());
-
- BOOST_CHECK( number("7fffffff", 16).can_convert_to<boost::int64_t>());
- BOOST_CHECK( number("80000000", 16).can_convert_to<boost::int64_t>());
-
- BOOST_CHECK( number("7fffffffffffffff", 16).can_convert_to<boost::int64_t>());
- BOOST_CHECK(!number("8000000000000000", 16).can_convert_to<boost::int64_t>());
- BOOST_CHECK(!number("8000000000000001", 16).can_convert_to<boost::int64_t>());
+ BOOST_CHECK( number("-80000001", 16).template can_convert_to<boost::int64_t>());
+ BOOST_CHECK( number("-80000000", 16).template can_convert_to<boost::int64_t>());
+ BOOST_CHECK( number("-7fffffff", 16).template can_convert_to<boost::int64_t>());
+
+ BOOST_CHECK( number("-1").template can_convert_to<boost::int64_t>());
+ BOOST_CHECK( number("0").template can_convert_to<boost::int64_t>());
+ BOOST_CHECK( number("1").template can_convert_to<boost::int64_t>());
+
+ BOOST_CHECK( number("7fffffff", 16).template can_convert_to<boost::int64_t>());
+ BOOST_CHECK( number("80000000", 16).template can_convert_to<boost::int64_t>());
+
+ BOOST_CHECK( number("7fffffffffffffff", 16).template can_convert_to<boost::int64_t>());
+ BOOST_CHECK(!number("8000000000000000", 16).template can_convert_to<boost::int64_t>());
+ BOOST_CHECK(!number("8000000000000001", 16).template can_convert_to<boost::int64_t>());
// uint64_t
- BOOST_CHECK(!number("-12930").can_convert_to<boost::uint64_t>());
- BOOST_CHECK(!number("-1").can_convert_to<boost::uint64_t>());
+ BOOST_CHECK(!number("-12930").template can_convert_to<boost::uint64_t>());
+ BOOST_CHECK(!number("-1").template can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("0").can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("1").can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("0").template can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("1").template can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("7fffffff", 16).can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("80000000", 16).can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("80000001", 16).can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("7fffffff", 16).template can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("80000000", 16).template can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("80000001", 16).template can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("ffffffff", 16).can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("100000000", 16).can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("ffffffff", 16).template can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("100000000", 16).template can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("7fffffffffffffff", 16).can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("8000000000000000", 16).can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("8000000000000001", 16).can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("7fffffffffffffff", 16).template can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("8000000000000000", 16).template can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("8000000000000001", 16).template can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("7fffffffffffffff", 16).can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("8000000000000000", 16).can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("8000000000000001", 16).can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("7fffffffffffffff", 16).template can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("8000000000000000", 16).template can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("8000000000000001", 16).template can_convert_to<boost::uint64_t>());
- BOOST_CHECK( number("ffffffffffffffff", 16).can_convert_to<boost::uint64_t>());
- BOOST_CHECK(!number("10000000000000001", 16).can_convert_to<boost::uint64_t>());
+ BOOST_CHECK( number("ffffffffffffffff", 16).template can_convert_to<boost::uint64_t>());
+ BOOST_CHECK(!number("10000000000000001", 16).template can_convert_to<boost::uint64_t>());
}
int test_main(int argc, char* argv[])
Modified: sandbox/SOC/2007/bigint/libs/bigint/test/comparison.cpp
==============================================================================
--- sandbox/SOC/2007/bigint/libs/bigint/test/comparison.cpp (original)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/comparison.cpp 2007-06-11 19:27:45 EDT (Mon, 11 Jun 2007)
@@ -267,14 +267,14 @@
{ \
BOOST_CHECK_EQUAL(a _op b, c); \
\
- if (a.can_convert_to<boost::int64_t>()) \
+ if (a.template can_convert_to<boost::int64_t>()) \
{ \
- BOOST_CHECK_EQUAL(a.to_number<boost::int64_t>() _op b, c); \
+ BOOST_CHECK_EQUAL(a.template to_number<boost::int64_t>() _op b, c); \
} \
\
- if (b.can_convert_to<boost::int64_t>()) \
+ if (b.template can_convert_to<boost::int64_t>()) \
{ \
- BOOST_CHECK_EQUAL(a _op b.to_number<boost::int64_t>(), c); \
+ BOOST_CHECK_EQUAL(a _op b.template to_number<boost::int64_t>(), c); \
} \
}
Modified: sandbox/SOC/2007/bigint/libs/bigint/test/number_conversion.cpp
==============================================================================
--- sandbox/SOC/2007/bigint/libs/bigint/test/number_conversion.cpp (original)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/number_conversion.cpp 2007-06-11 19:27:45 EDT (Mon, 11 Jun 2007)
@@ -49,8 +49,8 @@
BOOST_CHECK_EQUAL(oss.str(), v.str());
// bigint -> number
- BOOST_CHECK(v.can_convert_to<T>()); // we should be able to convert to T
- BOOST_CHECK_EQUAL(convert_to_number(v.to_number<T>()), convert_to_number(values[i]));
+ BOOST_CHECK(v.template can_convert_to<T>()); // we should be able to convert to T
+ BOOST_CHECK_EQUAL(convert_to_number(v.template to_number<T>()), convert_to_number(values[i]));
}
}
@@ -87,7 +87,7 @@
}
{
- unsigned int values[] = {0, 1, 200, 65535, 384983, 23849384, 1203002930, 2147483648, 4294967294, 4294967295};
+ unsigned int values[] = {0, 1, 200, 65535, 384983, 23849384, 1203002930, 2147483648u, 4294967294u, 4294967295u};
test_number_ctors<I>(values, ARRAY_SIZE(values));
}
@@ -100,13 +100,13 @@
for (size_t i = 0; i < ARRAY_SIZE(values); ++i)
{
- values[i] *= 2147483648; // 2^31
+ values[i] *= 2147483648u; // 2^31
values[i] *= 2; // 2^32
}
// first element is -2^31 * 2^32 == -2^63 - ok
// last element is (2^31 - 1) * 2^32 == 2^63 - 2^32 - too small
- values[ARRAY_SIZE(values) - 1] += 4294967295;
+ values[ARRAY_SIZE(values) - 1] += 4294967295u;
// testing unit tests
BOOST_CHECK(values[0] < 0 && values[0] - 1 > 0); // underflow
@@ -118,19 +118,19 @@
}
{
- boost::uint64_t values[] = {0, 1, 200, 65535, 384983, 23849384, 1203002930, 2147483648, 4294967294, 4294967295};
+ boost::uint64_t values[] = {0, 1, 200, 65535, 384983, 23849384, 1203002930, 2147483648u, 4294967294u, 4294967295u};
// small values
test_number_ctors<I>(values, ARRAY_SIZE(values));
for (size_t i = 0; i < ARRAY_SIZE(values); ++i)
{
- values[i] *= 2147483648; // 2^31
+ values[i] *= 2147483648u; // 2^31
values[i] *= 2; // 2^32
}
// last element is (2^32 - 1) * 2^32 == 2^64 - 2^32 - too small
- values[ARRAY_SIZE(values) - 1] += 4294967295;
+ values[ARRAY_SIZE(values) - 1] += 4294967295u;
// testing unit tests
BOOST_CHECK_EQUAL(values[ARRAY_SIZE(values) - 1] + 1, 0); // overflow
Modified: sandbox/SOC/2007/bigint/libs/bigint/test/stream.cpp
==============================================================================
--- sandbox/SOC/2007/bigint/libs/bigint/test/stream.cpp (original)
+++ sandbox/SOC/2007/bigint/libs/bigint/test/stream.cpp 2007-06-11 19:27:45 EDT (Mon, 11 Jun 2007)
@@ -38,6 +38,26 @@
{
typedef boost::bigint_base<I> number;
+#ifdef BOOST_NO_STD_WSTREAMBUF
+
+#define CHECK_OSS(expr, result) do \
+ { \
+ std::ostringstream oss; oss << expr; \
+ BOOST_CHECK_EQUAL(oss.str(), result); \
+ BOOST_CHECK(oss.good()); \
+ } \
+ while (0)
+
+#define CHECK_ISS_MOD_STATE(input, mod, result, state) do \
+ { \
+ number a(7); \
+ std::istringstream iss(input); iss >> mod >> a; \
+ BOOST_CHECK_EQUAL(a, number(result)); \
+ if (!state) BOOST_CHECK(iss.bad()); \
+ } while (0)
+
+#else
+
#define CHECK_OSS(expr, result) do \
{ \
std::ostringstream oss; oss << expr; \
@@ -62,9 +82,11 @@
const char* i = input; \
std::wistringstream wiss(std::wstring(i, i + strlen(i))); wiss >> mod >> b; \
BOOST_CHECK_EQUAL(b, number(result)); \
- if (!state) BOOST_CHECK(iss.bad()); \
+ if (!state) BOOST_CHECK(wiss.bad()); \
} while (0)
+#endif
+
#define CHECK_ISS_STATE(input, result, state) CHECK_ISS_MOD_STATE(input, std::skipws, result, state)
#define CHECK_ISS_MOD(input, mod, result) CHECK_ISS_MOD_STATE(input, mod, result, true)
@@ -198,6 +220,7 @@
BOOST_CHECK_EQUAL(iss.get(), 65);
}
+#ifndef BOOST_NO_STD_WSTREAMBUF
{
number b;
std::wistringstream wiss(L"-384ABC");
@@ -206,6 +229,7 @@
BOOST_CHECK_EQUAL(b, -384);
BOOST_CHECK_EQUAL(wiss.get(), 65);
}
+#endif
{
number a;
@@ -216,6 +240,7 @@
BOOST_CHECK_EQUAL(iss.get(), 90);
}
+#ifndef BOOST_NO_STD_WSTREAMBUF
{
number b;
std::wistringstream wiss(L"FFZYX");
@@ -224,6 +249,7 @@
BOOST_CHECK_EQUAL(b, 255);
BOOST_CHECK_EQUAL(wiss.get(), 90);
}
+#endif
{
number a;
@@ -234,6 +260,7 @@
BOOST_CHECK_EQUAL(iss.get(), 56);
}
+#ifndef BOOST_NO_STD_WSTREAMBUF
{
number b;
std::wistringstream wiss(L"1238a");
@@ -242,6 +269,7 @@
BOOST_CHECK_EQUAL(b, 83);
BOOST_CHECK_EQUAL(wiss.get(), 56);
}
+#endif
#undef CHECK_ISS
#undef CHECK_OSS
Modified: sandbox/SOC/2007/bigint/libs/bigint/todo.txt
==============================================================================
--- sandbox/SOC/2007/bigint/libs/bigint/todo.txt (original)
+++ sandbox/SOC/2007/bigint/libs/bigint/todo.txt 2007-06-11 19:27:45 EDT (Mon, 11 Jun 2007)
@@ -11,7 +11,7 @@
Feature name Deadline Status
------------ -------- ------
1. Bigint interface (header) 21 May Awaiting resolution
-2. GMP implementation 21 May In progress
+2. GMP implementation 21 May Awaiting resolution
3. Correctness tests 7 June In progress
4. Documentation 21 June N/A
5. Performance tests 7 July N/A
@@ -112,8 +112,8 @@
+ fix division and remainder to truncating ones
Status: fixed
-- remove warnings for both MSVC and GCC
-Status: needs fixing
++ remove warnings for both MSVC and GCC
+Status: fixed
3. Correctness tests
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk