view test/offset.c @ 935:7672a37e7545 default tip

Raspbery PI ARM support begin
author kono
date Sat, 24 Dec 2016 03:02:57 +0000
parents c2c709727221
children
line wrap: on
line source

extern int printf(const char *,...);

#ifndef INLINE
#define INLINE
#endif

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

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

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

#if 0
    printf("#0022:int ac =\t%x\n",&ac);
    printf("#0023:int midium[0] =\t%x\n",&midium[0]);
    printf("#0024:int midium[BIT12] =\t%x\n",&midium[BIT12]);
    printf("#0025:int large[0] =\t%x\n",&large[0]);
    printf("#0026:int large[BIT16] =\t%x\n",&large[BIT16]);
    printf("#0027:int local_midium[0] =\t%x\n",&local_midium[0]);
    printf("#0028:int local_midium[BIT12] =\t%x\n",&local_midium[BIT12]);
    printf("#0029:int local_large[0] =\t%x\n",&local_large[0]);
    printf("#0030: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("#0053:%x\n", midium[0]);
   printf("#0054:%x\n", large[0]);
   printf("#0055:%x\n", local_midium[0]);
   printf("#0056:%x\n", local_large[0]);

   printf("#0058:%x\n", midium[BIT8]);
   printf("#0059:%x\n", large[BIT8]);
   printf("#0060:%x\n", local_midium[BIT8]);
   printf("#0061:%x\n", local_large[BIT8]);

   printf("#0063:%x\n", midium[BIT10]);
   printf("#0064:%x\n", large[BIT10]);
   printf("#0065:%x\n", local_midium[BIT10]);
   printf("#0066:%x\n", local_large[BIT10]);

   printf("#0068:%x\n", midium[BIT12-1]);
   printf("#0069:%x\n", large[BIT16-1]);
   printf("#0070:%x\n", local_midium[BIT12-1]);
   printf("#0071:%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("#0081:%x\n", p[-1]);
   printf("#0082:%x\n", p[-BIT8]);
   printf("#0083:%x\n", p[-BIT10]);
   printf("#0084:%x\n", p[-(BIT12-1)]);
   printf("#0085:%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("#0095:%x\n", p[-1]);
   printf("#0096:%x\n", p[-BIT8]);
   printf("#0097:%x\n", p[-BIT10]);
   printf("#0098:%x\n", p[-(BIT12-1)]);
   printf("#0099:%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;
return 0;
}

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

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