Boost logo

Boost Users :

From: Jim.Hyslop (jim.hyslop_at_[hidden])
Date: 2003-07-09 08:40:17


victoriaames wrote:
> Example that doesn't work :
> std::cout << "Expected CRC-8 : EA" << std::endl;
> boost::crc_optimal<8, 0x9B, 0, 0, false, false> crc_8;
> crc_8 = std::for_each( data, data + data_len, crc_8 );
> std::cout << "Optimal CRC-8 : " << std::hex << crc_8() << std::endl;
>
> The results I get are :
>
> Expected CRC-CCITT : 29B1
> Optimal CRC-CCITT : 29b1
>
> Expected CRC-8 : EA
> Optimal CRC-8 : Û
>
> Does anyone know why the 8 bit example does not seem to work?
I haven't used this library, but judging from the output it looks to me like
it's working just fine. The result is an 8-bit value, i.e. a (possibly
unsigned) char, with the value 0xEA. Think about what cout does with 'char'.

-- 
Jim

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