diff test/offset.c @ 373:a9bc85fe6702

*** empty log message ***
author kono
date Sun, 11 Jul 2004 13:31:52 +0900
parents
children 91849fdeea60
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/offset.c	Sun Jul 11 13:31:52 2004 +0900
@@ -0,0 +1,70 @@
+
+#define BIT8 260
+#define BIT10 1030
+#define BIT12 5000
+#define BIT16 (65536*2)
+
+int midium[BIT12];
+int large[BIT16];
+
+main()
+{
+int *p;
+int local_midium[BIT12];
+int local_large[BIT16];
+
+  midium[0]=0x55;
+  large[0]=0x55;
+  local_midium[0]=0x55;
+  local_large[0]=0x55;
+
+  midium[BIT8]=0x50;
+  large[BIT8]=0x50;
+  local_midium[BIT8]=0x50;
+  local_large[BIT8]=0x50;
+
+  midium[BIT10]=0xa0;
+  large[BIT10]=0xa0;
+  local_midium[BIT10]=0xa0;
+  local_large[BIT10]=0xa0;
+
+  midium[BIT12-1]=0xaa;
+  large[BIT16-1]=0xaa;
+  local_midium[BIT12-1]=0xaa;
+  local_large[BIT16-1]=0xaa;
+
+   printf("%x\n", midium[0]);
+   printf("%x\n", large[0]);
+   printf("%x\n", local_midium[0]);
+   printf("%x\n", local_large[0]);
+
+   printf("%x\n", midium[BIT8]);
+   printf("%x\n", large[BIT8]);
+   printf("%x\n", local_midium[BIT8]);
+   printf("%x\n", local_large[BIT8]);
+
+   printf("%x\n", midium[BIT10]);
+   printf("%x\n", large[BIT10]);
+   printf("%x\n", local_midium[BIT10]);
+   printf("%x\n", local_large[BIT10]);
+
+   printf("%x\n", midium[BIT12-1]);
+   printf("%x\n", large[BIT16-1]);
+   printf("%x\n", local_midium[BIT12-1]);
+   printf("%x\n", local_large[BIT16-1]);
+
+   p = local_large+BIT16;
+
+   p[-1] = 0xaa;
+   p[-BIT8] = 0xbb;
+   p[-BIT10] = 0xcc;
+   p[-(BIT12-1)] = 0xdd;
+   p[-(BIT16-1)] = 0xee;
+
+   printf("%x\n", p[-1]);
+   printf("%x\n", p[-BIT8]);
+   printf("%x\n", p[-BIT10]);
+   printf("%x\n", p[BIT12-1]);
+   printf("%x\n", p[BIT16-1]);
+
+}