title: MISRA-C:2012 warning of Rule 10.8 "being cast to a wider type"
body: <p>I got a MISRA-C warning of Rule 10.8:
  A composite expression of 'essentially unsigned' type (unsigned char) is being cast to a wider unsigned type, 'unsigned short'.</p>
  
  <p>This warning was detected with the following code.</p>
  
  <pre><code>void Fucntion(unsigned char isSwitchOn) {
      unsigned short switchMask = 0U;
  
      switchMask |= (unsigned short)(isSwitchOn &amp; 1U) &lt;&lt; 1;
  </code></pre>
  
  <p>Why was a warning detected?
  Also, does this code cause problems?</p>
  
  <p>I think that the expression (isSwitchOn &amp; 1U) is converted to an int type and calculated, and the result is truncated and stored as an unsigned short type. Thinking like that, the warning seems unnatural to me.</p>