31-10-2016, 03:15 PM
The way bit-fields should be handled is described on page 53 of MISRA C++ 2008
It is possible that the problem is caused by the "& 0xFFU" which gives a value in the range 0..255 (i.e. 8 bit) which is assigned to a 7 bit field
Try using & 0x7FU which gives a value in the range 0..127, i.e. 7 bit. It's also possible that the static_cast to a 32-bit type is the cause of the problem
It is possible that the problem is caused by the "& 0xFFU" which gives a value in the range 0..255 (i.e. 8 bit) which is assigned to a 7 bit field
Try using & 0x7FU which gives a value in the range 0..127, i.e. 7 bit. It's also possible that the static_cast to a 32-bit type is the cause of the problem
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group