My code needs to multiply two values. I did not succeed to suppress the warning with any cast. How do I safely multiply by 60?
typedef struct { uint8_t uHour, uMinute, uSecond } STime;
const uint8_t MinutesPerHour = 60u;
STime Time = { 0u, 0u, 0u };
uint16_t u;
u = Time.uHour;
u = MinutesPerHour;
u = (Time.uHour * MinutesPerHour);
u = (uint16_t)(Time.uHour * MinutesPerHour);
I get the MISRA warning 10.1 for the last two lines.