Mercurial > hg > CbC > old > device
comparison test/offset.c @ 373:a9bc85fe6702
*** empty log message ***
author | kono |
---|---|
date | Sun, 11 Jul 2004 13:31:52 +0900 |
parents | |
children | 91849fdeea60 |
comparison
equal
deleted
inserted
replaced
372:81345636387d | 373:a9bc85fe6702 |
---|---|
1 | |
2 #define BIT8 260 | |
3 #define BIT10 1030 | |
4 #define BIT12 5000 | |
5 #define BIT16 (65536*2) | |
6 | |
7 int midium[BIT12]; | |
8 int large[BIT16]; | |
9 | |
10 main() | |
11 { | |
12 int *p; | |
13 int local_midium[BIT12]; | |
14 int local_large[BIT16]; | |
15 | |
16 midium[0]=0x55; | |
17 large[0]=0x55; | |
18 local_midium[0]=0x55; | |
19 local_large[0]=0x55; | |
20 | |
21 midium[BIT8]=0x50; | |
22 large[BIT8]=0x50; | |
23 local_midium[BIT8]=0x50; | |
24 local_large[BIT8]=0x50; | |
25 | |
26 midium[BIT10]=0xa0; | |
27 large[BIT10]=0xa0; | |
28 local_midium[BIT10]=0xa0; | |
29 local_large[BIT10]=0xa0; | |
30 | |
31 midium[BIT12-1]=0xaa; | |
32 large[BIT16-1]=0xaa; | |
33 local_midium[BIT12-1]=0xaa; | |
34 local_large[BIT16-1]=0xaa; | |
35 | |
36 printf("%x\n", midium[0]); | |
37 printf("%x\n", large[0]); | |
38 printf("%x\n", local_midium[0]); | |
39 printf("%x\n", local_large[0]); | |
40 | |
41 printf("%x\n", midium[BIT8]); | |
42 printf("%x\n", large[BIT8]); | |
43 printf("%x\n", local_midium[BIT8]); | |
44 printf("%x\n", local_large[BIT8]); | |
45 | |
46 printf("%x\n", midium[BIT10]); | |
47 printf("%x\n", large[BIT10]); | |
48 printf("%x\n", local_midium[BIT10]); | |
49 printf("%x\n", local_large[BIT10]); | |
50 | |
51 printf("%x\n", midium[BIT12-1]); | |
52 printf("%x\n", large[BIT16-1]); | |
53 printf("%x\n", local_midium[BIT12-1]); | |
54 printf("%x\n", local_large[BIT16-1]); | |
55 | |
56 p = local_large+BIT16; | |
57 | |
58 p[-1] = 0xaa; | |
59 p[-BIT8] = 0xbb; | |
60 p[-BIT10] = 0xcc; | |
61 p[-(BIT12-1)] = 0xdd; | |
62 p[-(BIT16-1)] = 0xee; | |
63 | |
64 printf("%x\n", p[-1]); | |
65 printf("%x\n", p[-BIT8]); | |
66 printf("%x\n", p[-BIT10]); | |
67 printf("%x\n", p[BIT12-1]); | |
68 printf("%x\n", p[BIT16-1]); | |
69 | |
70 } |