Closed kaysievers closed 4 years ago
Here is a 32bit signed integer field:
typedef struct { uint8_t address; int32_t value; } TMCRegisterConstant;
Which gets several values assigned that do not fit into this data type:
{ 0x60, 0xAAAAB554 }, // MSLUT[0] ... { 0x64, 0xFBFFFFFF }, // MSLUT[4] { 0x65, 0xB5BB777D }, // MSLUT[5] ...
The compiler rightfully complains about this:
TMC2130.h:92:1: error: narrowing conversion of '2863314260' from 'unsigned int' to 'int32_t' {aka 'long int'} [-Wnarrowing] 92 | };
Could the field be changed to unsigned, or a cast added to the initializer value to avoid this?
Fixed in b66f8f2df8551392156c85b1636ead3bf8439e22.
Here is a 32bit signed integer field:
Which gets several values assigned that do not fit into this data type:
The compiler rightfully complains about this:
Could the field be changed to unsigned, or a cast added to the initializer value to avoid this?