//start
#include <stdio.h>
const int SIZE = 100;
char buff[SIZE];
unsigned int dat[]={0x4500,
0x003c ,
0x4d65 ,
0x0000 ,
0x8001,
0x0000 ,
0xac10 ,
0xe027,
0xac10 ,
0xe001};
int main(){
int i;
int len =sizeof(dat)/sizeof(dat[0]);
printf("len:%d\n",len);
int sum=0;
for (i=0;i<len;i++){
printf("0x%04X\n",dat[i]);
sum+=dat[i];
}
sum=(sum>>16)+(sum&0xffff);
sum=~sum;
printf("0x%04x\n",(sum&0xffff)); // 0xd511
return 0;
}
/*
0000 00 0d 66 ba f8 00 00 21 5d 45 91 5e 08 00 45 00 ..f....! ]E.^..E.
0010 00 3c 4d 65 00 00 80 01 d5 11 ac 10 e0 27 ac 10 .<Me.... .....'..
0020 e0 01 08 00 06 5c 02 00 45 00 61 62 63 64 65 66 .....\.. E.abcdef
0030 67 68 69 6a 6b 6c 6d 6e 6f 70 71 72 73 74 75 76 ghijklmn opqrstuv
0040 77 61 62 63 64 65 66 67 68 69 wabcdefg hi
*/
//end