Boost logo

Boost Users :

Subject: [Boost-users] assert (crc2.checksum() == crc1) failed in sample of Augmented-CRC Functions
From: Alexander Vinokur (Alexander.Vinokur_at_[hidden])
Date: 2008-09-22 02:08:01


 

Hi,

 

I run the sample of Augmented-CRC Functions on Microsoft Visual C++ 2005

But assert(crc2.checksum() == crc1) failed.

 

http://www.boost.org/doc/libs/1_36_0/libs/crc/crc.html#crc_basic

 

Augmented-CRC Functions

 

// Main function
int
main ()
{
    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
    assert( crc2.checksum() == crc1 );
 
    std::cout << "All tests passed." << std::endl;
    return 0;
}

 

 

Alex Vinokur

 

This message and the information contained herein is proprietary and confidential and subject to the Amdocs policy statement,
you may review at http://www.amdocs.com/email_disclaimer.asp



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net