Code:
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <sys/ioctl.h>
5 #include <sys/time.h>
6
7 #define BS (32*1024)
8 char buf0[BS];
9 char buf1[BS];
10
11 #define SWAP64(p) ( (*(unsigned __int64*)(p)) = _byteswap_uint64(*(unsigned __int64*)(p)) )
12
13 int main(void)
14 {
15 int i,j;
16 FILE *ff = fopen("testFdd.dat","rb");
17 long pos0=0, pos1;
18
19 long max_k = 15;
20
21 while(1)
22 {
23 memset(buf1,0,BS);
24 pos1 = ftell(ff);
25 if( fread(buf1,BS,1,ff) != 1 ) break;
26 for(i=0 ; i<BS-4 ; i++ )
27 {
28 if( memcmp(buf1+i,"/fdd",4)==0 )
29 {
30 break;
31 }
32 }
33 if( i>=BS-4 ) continue; // didn't find
34
35 pos1 = pos1+i-0x40;
36 fseek(ff,pos1,SEEK_SET);
37 fread(buf1,1,BS,ff);
38 fseek(ff,pos1+0x41,SEEK_SET);
39
40 SWAP64(buf1);
41 SWAP64(buf1+0x18);
42 printf("%07x: %-7.7s %30s %lg %lg\n",pos1,buf1+8, buf1+0x20, *(double*)(buf1),* (double*)(buf1+0x18));
43 int n = pos1-pos0;
44 if( n>BS ) n=BS;
45 if( pos0!=0 && max_k-- > 0 )
46 {
47 printf("\n");
48 for( i=256+64 ; i<n ; i+=8 )
49 {
50 if( memcmp(buf0+i,buf1+i,8)!=0 )
51 {
52 SWAP64(buf1+i);
53 printf("\t+%04x: %+21.15le -> %+21.15le (%+16lg)\n",i, *(double*)(buf0+i),*(double*)(buf1+i),*(double*)(buf1+i)-*(double*)(buf0+i));
54 }
55 }
56 printf("\n");
57 }
58
59 pos0 = pos1;
60 memmove(buf0,buf1,n);
61 }
62 }
I'm trying to compile the above code, but i get error: expected primary-expression before ‘unsigned’