view test/offset.c @ 384:5fc059f1947d

ARM continue...
author kono
date Wed, 21 Jul 2004 13:52:13 +0900
parents b23568be1155
children 0c256ea2a97e
line wrap: on
line source


#define BIT8 260
#define BIT10 1030
#define BIT12 5000
#define BIT16 (65536*2)

int midium[BIT12];
int large[BIT16];


main0(int ac,char *av[])
{
int *p;
int local_midium[BIT12];
int local_large[BIT16];

#if 0
    printf("int ac =\t%x\n",&ac);
    printf("int midium[0] =\t%x\n",&midium[0]);
    printf("int midium[BIT12] =\t%x\n",&midium[BIT12]);
    printf("int large[0] =\t%x\n",&large[0]);
    printf("int large[BIT16] =\t%x\n",&large[BIT16]);
    printf("int local_midium[0] =\t%x\n",&local_midium[0]);
    printf("int local_midium[BIT12] =\t%x\n",&local_midium[BIT12]);
    printf("int local_large[0] =\t%x\n",&local_large[0]);
    printf("int local_large[BIT16] =\t%x\n",&local_large[BIT16]);
#endif

  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)]);

   p = 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)]);


    for(p=local_midium;p<&local_midium[BIT12];p++) *p = p-local_midium;
    for(p=local_large;p<&local_large[BIT16];p++) *p = p-local_large;

    for(p=midium;p<&midium[BIT12];p++) *p = p-midium;
    for(p=large;p<&large[BIT16];p++) *p = p-large;

}

main(int ac,char *av[])
{
    int i=-1,j=-2,k=-3;
    
    main0(ac,av);

    printf("%d %d %d %d\n",ac,i,j,k);
    return 0;
}