tpircher-zz / pycrc

Free, easy to use Cyclic Redundancy Check (CRC) calculator and source code generator
https://pycrc.org
MIT License
169 stars 36 forks source link

Slice-by-8 CRC16: Problem with type of d1,d2 in generated code #39

Open TomWalliser opened 4 years ago

TomWalliser commented 4 years ago

When generating code for this:

the generated code contains this: typedef uint_fast16_t crc_t;

If uint_fast16_t is actually 32 bits, this will make my tables twice as big as they need to be, so I substituted uint16_t for crc_t, but this is also a problem: In the following generated code (LE version shown) crc_t d1 = d32++ ^ crc; crc_t d2 = d32++; the type of d1 and d2 should NOT be 16-bits. I changed the types here to uint32_t and everything seems to work fine.

TomWalliser commented 4 years ago

Same issue applies to slice-by-4 CRC16