Skip to content

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

@TomWalliser

Description

@TomWalliser

When generating code for this:

  • Generated on Wed Feb 19 00:52:04 2020
  • by pycrc v0.9.2, https://pycrc.org
  • using the configuration:
    • Width = 16
    • Poly = 0x8005
    • XorIn = 0x0000
    • ReflectIn = True
    • XorOut = 0x0000
    • ReflectOut = True
    • Algorithm = table-driven
    • SliceBy = 8

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions