Subject: [Boost-bugs] [Boost C++ Libraries] #9383: augmented_crc example fails
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-11-13 11:35:36
#9383: augmented_crc example fails
-------------------------------------------+------------------------
Reporter: Dominik Muth <dominik.muth@â¦> | Owner: dlwalker
Type: Bugs | Status: new
Milestone: To Be Determined | Component: crc
Version: Boost 1.55.0 | Severity: Regression
Keywords: augmented_crc |
-------------------------------------------+------------------------
I just built Boost 1.55.0 with VS 2008. Runs, but the example from
http://www.boost.org/doc/libs/1_55_0/libs/crc/crc.html#crc_func
fails.
Source:
{{{
// boost_ending.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <boost/crc.hpp> // for boost::crc_basic,
boost::augmented_crc
#include <boost/cstdint.hpp> // for boost::uint16_t
#include <cassert> // for assert
#include <iostream> // for std::cout
#include <ostream> // for std::endl
// Main function
int _tmain(int argc, _TCHAR* argv[]) {
using boost::uint16_t;
using boost::augmented_crc;
uint16_t data[6] = { 2, 4, 31, 67, 98, 0 };
uint16_t const init_rem = 0x123;
uint16_t crc1 = augmented_crc<16, 0x8005>( data, sizeof(data),
init_rem );
uint16_t const zero = 0;
uint16_t const new_init_rem = augmented_crc<16, 0x8005>( &zero,
sizeof(zero) );
boost::crc_basic<16> crc2( 0x8005, new_init_rem );
crc2.process_block( data, &data[5] ); // don't include CRC
std::cout << "crc2: " << crc2.checksum() << std::endl;
std::cout << "crc1: " << crc1 << std::endl;
assert( crc2.checksum() == crc1 );
std::cout << "All tests passed." << std::endl;
std::cin.ignore();
return 0;
}
}}}
Output:
{{{
crc2: 22581
crc1: 36743
Assertion failed: crc2.checksum() == crc1, file boost_ending.cpp, line 33
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9383> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC