Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-09-23 03:57:52


Craig Henderson wrote:
> There is a small problem with the CRC library that is shown up at runtime
> with the MSVC7 compiler option "Smaller Type Check" /RTCc. The problem is in
> crc.hpp at line 550 which reads
>
> { return x ^ ( rem >> (DoReflect ? 0u : Bits - CHAR_BIT) ); }
>
> Changing this to
> { return 0xff & (x ^ ( rem >> (DoReflect ? 0u : Bits - CHAR_BIT) ) ); }
>
> solves the problem.

Hi Graig,
can you tell more about that warning? Is it triggered whenever int
converted to unsigned char has value larger than 255? In this particular
case, that's precisely what is desired. Is it possible to suppress this
warning without adding extra operation --- I'm not sure all compilers
will optimize it.

BTW, Daryle, I think that the comment to the function 'index' which
contains this warning:

     // Compare a byte to the remainder's highest byte
     static unsigned char index( value_type rem, unsigned char x )

is rather misleading. It's been long since I last looked in CRC, so I
can't offer better comment off-hand, but I believe "compare" implies
true or false result, not index into precomputed crc table. What do you
think?

- Volodya


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk