title: Convert a 32-bit number to 16-bit
body: <p>I need to convert a number to a percentage of my DAC's max value (0x0FFF) so my code to do that would be like this:</p>
  
  <pre><code>double percent;
  short pct;
  
  percent = (0x0FFF * pct)/100;
  </code></pre>
  
  <p>but I need a 16-bit value to send to the DAC not a 32-bit one. What is the quickest way to convert it to a 16-bit number? Can I shift it in?</p>