title: math operation between 2 uint32_t returning an uint64_t
body: <p>I'm trying to implement an operation, a function, with an interface like this one <code>uint64_t foo(uint32_t,uint32_t)</code> , so this is a simple implementation:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdint&gt; 
  
  uint64_t foo(const uint32_t &amp;a, const uint32_t &amp;b) {    
    return ((reinterpret_cast&lt;const uint64_t &amp;&gt;(a)) +
            (reinterpret_cast&lt;const uint64_t &amp;&gt;(b)));
  }
  
  int main() {
    uint32_t k1 = ~0;
    uint32_t k2 = 1;
    std::cout &lt;&lt; foo(k1, k2) &lt;&lt; "\n";
    return (0);
  }
  </code></pre>
  
  <p>Now my focus is on the <code>reinterpret_cast</code> and the <code>+</code> operator.</p>
  
  <p>the <code>+</code> operator should be fine where it is because it's being called by 2 <code>uint64_t</code>; so the problem is the <code>reinterpret_cast</code> ? I don't get why ...
  My speculation is about the chunk of memory that is near <code>a</code> or <code>b</code>, so the result of the <code>reinterpret_cast</code> is a 50% of the original <code>a</code> or <code>b</code> and the other 50% is a random chunk of memory. I this how this cast really works ?</p>
  
  <p>I already tried several versions of a <code>reinterpret_cast</code>, even with pointers, with no luck.</p>