title: Pointer assignment - uint16_t
body: <p>I was looking at a problem from <a href="http://www-inst.eecs.berkeley.edu/~cs61c/sp15/" rel="nofollow">cs61c (ucb)</a>.
  I have the following method:</p>
  
  <pre><code>void lfsr_calculate(uint16_t *reg) {                                      
    uint16_t result = compute_bit_val(*reg);                              
    printf("reg value: %d", *reg);                                        
    printf("bit val result: %d", result);                                 
    printf("bit val result shifted: %d", result &lt;&lt; 16);                   
    *reg &gt;&gt;= 1;                                                           
    printf("bit val result shifted plus zero: %d", *reg + (result &lt;&lt; 16));
    *reg = (uint16_t) *reg + (result &lt;&lt; 16);                              
    printf("new reg: %d", *reg);                                          
  }
  </code></pre>
  
  <p>If *reg is 1, my method compute_bit_val returns 1. The print output is</p>
  
  <pre><code>1 
  
  1
  
  65536
  
  65536
  
  **0**
  </code></pre>
  
  <p>?!?!?! I am pulling out my hair, I don't know why the last part is zero, for some reason the assignment is not working. I tried this with and without casting, and it gives the same result.</p>