Opened 9 years ago

#9383 new Bugs

augmented_crc example fails

Reported by: Dominik Muth <dominik.muth@…> Owned by: Daryle Walker
Milestone: To Be Determined Component: crc
Version: Boost 1.55.0 Severity: Regression
Keywords: augmented_crc Cc:

Description

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

Change History (0)

Note: See TracTickets for help on using tickets.