|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83212 - in trunk: boost libs/crc/test
From: steven_at_[hidden]
Date: 2013-02-28 17:38:49
Author: steven_watanabe
Date: 2013-02-28 17:38:48 EST (Thu, 28 Feb 2013)
New Revision: 83212
URL: http://svn.boost.org/trac/boost/changeset/83212
Log:
Fix crc on msvc
Text files modified:
trunk/boost/crc.hpp | 2 +-
trunk/libs/crc/test/crc_test2.cpp | 30 ++++++++++++++++++------------
2 files changed, 19 insertions(+), 13 deletions(-)
Modified: trunk/boost/crc.hpp
==============================================================================
--- trunk/boost/crc.hpp (original)
+++ trunk/boost/crc.hpp 2013-02-28 17:38:48 EST (Thu, 28 Feb 2013)
@@ -588,7 +588,7 @@
// The natural reading order for division is highest digit/bit first.
// The "reflect" parameter switches this. However, building a bit mask
// for the lowest bit is the easiest....
- new_dividend_bits = reflect_optionally( new_dividend_bits, not reflect,
+ new_dividend_bits = reflect_optionally( new_dividend_bits, !reflect,
word_length );
// Perform modulo-2 division for each new dividend input bit
Modified: trunk/libs/crc/test/crc_test2.cpp
==============================================================================
--- trunk/libs/crc/test/crc_test2.cpp (original)
+++ trunk/libs/crc/test/crc_test2.cpp 2013-02-28 17:38:48 EST (Thu, 28 Feb 2013)
@@ -474,6 +474,12 @@
}
BOOST_AUTO_TEST_SUITE ( sub_octet_crc_tests )
+
+// Optimal computer, via the single-run function
+unsigned crc_f1( const void * buffer, std::size_t byte_count )
+{
+ return boost::crc<3u, 0x03u, 0u, 0u, false, false>( buffer, byte_count );
+}
BOOST_AUTO_TEST_CASE( sub_nybble_polynominal_test )
{
@@ -507,19 +513,22 @@
crc_1.process_bytes( samples[3], 4u );
BOOST_CHECK_EQUAL( crc_1.checksum(), 0u );
- // Optimal computer, via the single-run function
- BOOST_AUTO( crc_f, &(boost::crc<3u, 0x03u, 0u, 0u, false, false>) );
-
- BOOST_CHECK_EQUAL( crc_f(samples[ 0 ], 4u), 0u );
- BOOST_CHECK_EQUAL( crc_f(samples[ 1 ], 4u), 0u );
- BOOST_CHECK_EQUAL( crc_f(samples[ 2 ], 4u), 0u );
- BOOST_CHECK_EQUAL( crc_f(samples[ 3 ], 4u), 0u );
+ BOOST_CHECK_EQUAL( crc_f1(samples[ 0 ], 4u), 0u );
+ BOOST_CHECK_EQUAL( crc_f1(samples[ 1 ], 4u), 0u );
+ BOOST_CHECK_EQUAL( crc_f1(samples[ 2 ], 4u), 0u );
+ BOOST_CHECK_EQUAL( crc_f1(samples[ 3 ], 4u), 0u );
// TODO: do similar tests with boost::augmented_crc<3, 0x03>
// (Now I think that this can't be done right now, since that function reads
// byte-wise, so the register size needs to be a multiple of CHAR_BIT.)
}
+// Optimal computer, via the single-run function
+unsigned crc_f2( const void * buffer, std::size_t byte_count )
+{
+ return boost::crc<7u, 0x09u, 0u, 0u, false, false>( buffer, byte_count );
+}
+
BOOST_AUTO_TEST_CASE( sub_octet_polynominal_test )
{
// The CRC standard is a SDH/SONET J0/J1/J2/N1/N2/TR TTI (trace message)
@@ -547,11 +556,8 @@
crc_1.process_bytes( samples[1], 16u );
BOOST_CHECK_EQUAL( crc_1.checksum(), results[1] );
- // Optimal computer, via the single-run function
- BOOST_AUTO( crc_f, &(boost::crc<7u, 0x09u, 0u, 0u, false, false>) );
-
- BOOST_CHECK_EQUAL( crc_f(samples[ 0 ], 16u), results[0] );
- BOOST_CHECK_EQUAL( crc_f(samples[ 1 ], 16u), results[1] );
+ BOOST_CHECK_EQUAL( crc_f2(samples[ 0 ], 16u), results[0] );
+ BOOST_CHECK_EQUAL( crc_f2(samples[ 1 ], 16u), results[1] );
// TODO: do similar tests with boost::augmented_crc<7, 0x09>
// (Now I think that this can't be done right now, since that function reads
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