标签:
unsigned int x = 1234567;
byte* intBytes = new byte[4];
//方法一
memcpy(intBytes, &x, sizeof(unsigned int));
unsigned int y1 = intBytes[3] *256*256*256 + intBytes[2] *256*256 + intBytes[1]* 256 + intBytes[0];
//方法二
intBytes[0] = (byte) (x >> 24);
intBytes[1] = (byte) (x >> 16);
intBytes[2] = (byte) (x >> 8);
intBytes[3] = (byte) (x >> 0);
unsigned int y2 = intBytes[0] *256*256*256 + intBytes[1] *256*256 + intBytes[2]* 256 + intBytes[3];
标签:
原文地址:http://blog.csdn.net/senophen/article/details/44183265