How to store a 64 bit integer in two 32 bit integers and convert back again

前端 未结 6 973
太阳男子
太阳男子 2020-11-30 02:09

I\'m pretty sure its just a matter of some bitwise operations, I\'m just not entirely sure of exactly what I should be doing, and all searches return back \"64 bit vs 32 bit

6条回答
  •  感情败类
    2020-11-30 02:20

    Or this, if you're not interested in what the two 32-bits numbers mean:

    u32 x[2];
    u64 z;
    memcpy(x,&z,sizeof(z));
    memcpy(&z,x,sizeof(z));
    

提交回复
热议问题