| 673 | } |
| 674 | |
| 675 | Parity32::Parity32(uint32_t generator, unsigned width, bool invertFirst) |
| 676 | { |
| 677 | mMask = (((uint32_t)1<<width) - 1); |
| 678 | mInitialRemainder = invertFirst ? mMask : 0; |
| 679 | // If it is a 32-bit generator, dont bother passing in bit 33, |
| 680 | // which gets shifted off the top of the 32-bit generator argument. |
| 681 | if (width == 32) { |
| 682 | // untested: The 33rd bit is off the top, so put it back. |
| 683 | // Note that this would work for both cases, but clearer to separate it. |
| 684 | mInvertedGenerator = (revbits(generator,32) >> 1) | (1<<31); |
| 685 | } else { |
| 686 | mInvertedGenerator = revbits(mMask & generator,24); |
| 687 | } |
| 688 | genParityTab(mInvertedGenerator,mTab); |
| 689 | } |
| 690 | |
| 691 | uint32_t Parity32::computeCrc(unsigned char *str, int len) |
| 692 | { |
nothing calls this directly
no test coverage detected