title: C typecasting uint32 to uint16
body: <pre><code>typedef struct a{
      uint32 val1;
      }A;
  
  typedef struct b{
      uint16 copy_val1;
  }B; 
  
  
  void function1(A input)
  {
      B my_input;
  
      my_input.copy_val1 = (uint16) input.val1; &lt;-- Is this clean?
  }
  </code></pre>
  
  <p>Inititally when struct a was designed, it was thought that val1 will contain two 16 bit values. However we chose to use only one 16 bit.</p>
  
  <p>Now I am changing the copy_val1's type from uint32 to uint16 to save memory.
  How should I typecast in a clean way and make sure that the 16 bit value from val1 get's copied to copy_val1?</p>
  
  <p>The OS is vxworks in MIPS architecture.</p>