title: How to change uint16_t to two uint8_t?
body: <p>How to convert one uint16_t to two parts?</p>
  
  <pre><code>uint16_t value = 0x7133;
  uint8_t partA = (uint8_t)((value &amp; 0xFF00) &gt;&gt; 8);
  uint8_t partB = (uint8_t)(value &amp; 0x00FF);
  std::cout &lt;&lt; std::hex &lt;&lt; partA &lt;&lt; std::endl; 
  std::cout &lt;&lt; std::hex &lt;&lt; partB &lt;&lt; std::endl;
  </code></pre>
  
  <p>For the above code I get <code>partA</code> as <code>q</code> and <code>partB</code> as <code>3</code> instead of <code>0x71</code> and <code>0x33</code>.</p>