Message98396
| Author |
cmcqueen1975 |
| Recipients |
cmcqueen1975, dtorp, josiahcarlson, mark.dickinson, tim.peters |
| Date |
2010年01月27日.00:50:08 |
| SpamBayes Score |
4.7765405e-09 |
| Marked as misclassified |
No |
| Message-id |
<1264553409.74.0.263939612934.issue1205239@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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! |
|