title: how to assign 64 bit unsigned long long to 32 bit structure in 32 bit architecture
body: <p>I have 2 cores, one is 32 bit and other is 64 bit.</p>
  
  <p>On 64 bit machine, I have support for unsigned long long, and I need to assign this value to a varriable which will be access in 32 bit machine, such as:-</p>
  
  <pre><code>typedef struct {
      unsigned int low;
      unsigned int high;
  } myint64_t;
  
  myint64_t app_sc;
  </code></pre>
  
  <p>Below is the code snippet for 64 bit machine:</p>
  
  <pre><code>unsigned long long sc;
  
  /* Calculate sc */
  ...
  </code></pre>
  
  <p>Now on 64 bit machine, I need to assign "sc" to app_sc, and use it for some computing on 64 bit machine.</p>
  
  <p>I was trying to do something like this:-</p>
  
  <pre><code>app_sc = sc;
  </code></pre>
  
  <p>but compiler gives me compile time errors.
  I can similarly do, something like this:-</p>
  
  <pre><code> app_sc.low = sc &amp; 0xFFFFFFFF;
   app_sc.high = (sc&gt;&gt;32) &amp; (0xFFFFFFFF);
  </code></pre>
  
  <p>But does that guarantee, it will work in all cases?</p>
  
  <p>Is there any better way of doing it?</p>