Message98396
To complete that thought...
Since crc << 8 could bump the calculation into long territory, for that final mask I guess I'd want to mask and then shift. I.e. rather than
crc_mask = ((1 << crc_width) - 1)
crc = (...) ^ ((crc << 8) & crc_mask)
do:
crc_lower_mask = ((1 << (crc_width - 8)) - 1)
crc = (...) ^ ((crc & crc_lower_mask) << 8)
But that expression should evaluate to 0 if crc_width <= 8, so I guess I'll need to special-case it. And if I special-case it, I don't need to shift by a negative value after all! |
|
Date |
User |
Action |
Args |
2010-01-27 00:50:09 | cmcqueen1975 | set | recipients:
+ cmcqueen1975, tim.peters, josiahcarlson, mark.dickinson, dtorp |
2010-01-27 00:50:09 | cmcqueen1975 | set | messageid: <1264553409.74.0.263939612934.issue1205239@psf.upfronthosting.co.za> |
2010-01-27 00:50:08 | cmcqueen1975 | link | issue1205239 messages |
2010-01-27 00:50:08 | cmcqueen1975 | create | |
|