void serializeu64(unsigned long long i,char buf[]) { unsigned long long mask = 0xff00000000000000;//字节掩码位 for(int l = 0;l<8;l++) { auto move = 8-l-1; auto f = i&mask;//取对应字节掩码位的字节数据 char res = (char)(f>>(8*move)); buf[l]=res; mask = mask >> 8; } } unsigned long long deserializeu64(char buf[]) { unsigned long long i=0; for(int l = 0;l<8;l++) { auto move = 8 -l -1; unsigned char res =buf[l]; unsigned long long ress = (unsigned long long)res; i += (unsigned long long)(ress<<(move*8)); } return i; }