RE: [Boost-Users] Re: CRC problem with 8 bit truncated polynomial
I'm guessing this should be
std::cout << "Optimal CRC-8 : " << std::hex << (unsigned)crc_8() << std::endl;
The way iostreams format chars is most likely not what you wanted. True enough - and that includes signed vs. unsigned chars (both are handled
Vladimir Prus wrote: the same, at least with my compiler). The result needs to be put into an unsigned *int* for cout to display the numeric value. -- Jim
Thanks to Jim and Vladimir you are both correct. There is no problem with the algorithm. I just had a problem outputting the value correctly to the command line. I appreciate the help. Regards, Victoria
Hi Jim, Jim.Hyslop wrote:
Vladimir Prus wrote:
I'm guessing this should be
std::cout << "Optimal CRC-8 : " << std::hex << (unsigned)crc_8() << std::endl;
The way iostreams format chars is most likely not what you wanted. True enough - and that includes signed vs. unsigned chars (both are handled the same, at least with my compiler).
The result needs to be put into an unsigned *int* for cout to display the numeric value.
Sorry, I don't understand what you're saying... std::cout << "Optimal CRC-8 : " << std::hex << (unsigned)crc_8() << std::endl; is the same as std::cout << "Optimal CRC-8 : " << std::hex << (unsigned int)crc_8() << std::endl; AFAIK. - Volodya
participants (3)
-
Jim.Hyslop
-
victoriaames
-
Vladimir Prus