Exemplo n.º 1
0
int main()
{
   int i,n,o;

   for(i=0;i<1000;i++) strcpy(a[i],"");
   while(1) {
      gets(s);
      i=get3(s,0);
      if(i==0) break;
      strcpy(a[i],s+3);
   }
   gets(s);
   n=get3(s,0);
   do {
      i=t=0;
      do {
         tr[i]=get3(s,3);
         ta[i]=strtol(s+6,NULL,10);
         t+=ta[i++];
         gets(s);
         o=get3(s,0);
      } while(o==n);
      if(t) {
         printf("*** Transaction %d is out of balance ***\n",n);
         for(n=0;n<i;n++)
            printf("%03d %-30s %10.2f\n",tr[n],a[tr[n]],(double)ta[n]/100);
         printf("999 Out of Balance                 %10.2f\n\n",(double)abs(t)/100);
      }
      n=o;
   } while(n);
}
Exemplo n.º 2
0
static void getll(int f)
{
    int l, d;
    char *c;
    c = field[f++];
    l = get2(c);
    c += 2;
    d = (getndp(c, 5) + 1) / 6;
    c = field[f++];
    l *= 1000000;
    l += d;
    if (*c != 'N')
        l = -l;
    //    if (l != gpst.llat)
    //        chg = 1;
    gpst.llat = l;
    c = field[f++];
    l = get3(c);
    c += 3;
    d = (getndp(c, 5) + 1) / 6;
    c = field[f];
    l *= 1000000;
    l += d;
    if (*c != 'E')
        l = -l;
    //    if (l != gpst.llon)
    //        chg = 1;
    gpst.llon = l;
}
Exemplo n.º 3
0
void *
child(void *v)
{
	unsigned long long index_f ;
	unsigned int index_0 ;

	sem_wait(&sem);	// down()
	while(chains < table_length){
		sem_post(&sem);	// up()

		sem_wait(&sem2);	// down()
			i_index++ ;
			index_0 = i_index ;
		sem_post(&sem2);	// up()

		index_f = generate_chain(index_0,num_table);

		sem_wait(&sem);	// down()
			if(get3(&hash_table,index_f)){
				coll++;
			}else{
				put3(&hash_table,index_f,index_0);
				chains++;
			}
	}
	sem_post(&sem);	// up()


	pthread_exit(0);
}
Exemplo n.º 4
0
static void gethms(int i)
{
    //hms field[i]
    char *c = field[i];
    gpst.hr = get2(c);
    gpst.mn = get2(&c[2]);
    gpst.sc = get2(&c[4]);
    if (c[6] && c[6] == '.')
        gpst.scth = get3(&c[7]);
}
Exemplo n.º 5
0
bool Decimate::getNextFrame(uint32_t *fn,ADMImage *data)
{
    switch(configuration.mode)
    {
        case 0: return get0(fn,data);break;
        case 1: return get1(fn,data);break;
        case 2: return get2(fn,data);break;
        case 3: return get3(fn,data);break;     
        default: ADM_assert(0);
    }
    return false;
}
Exemplo n.º 6
0
/*
 * Function: grain_keystream
 *
 * Synopsis
 *  Generates a new bit and updates the internal state of the cipher.
 */
u8 grain_keystream(ECRYPT_ctx* ctx) {
   u32 x0  = get3(S),
       x1  = get25(S),
       x2  = get46(S),
       x3  = get64(S),
       x4  = get63(B);

   u32 Z   = get1(B) ^ get2(B) ^ get4(B) ^ get10(B) ^ get31(B) ^ get43(B) ^ get56(B) ^ h(x0,x1,x2,x3,x4);
   u32 S80 = get62(S) ^ get51(S) ^ get38(S) ^ get23(S) ^ get13(S) ^ get0(S);

#if !defined(COMBINE_TERMS)

   u32 B80 =(get0(S)) ^ (get62(B)) ^ (get60(B)) ^ (get52(B)) ^ (get45(B)) ^ (get37(B)) ^ (get33(B)) ^ (get28(B)) ^ (get21(B))^
      (get14(B)) ^ (get9(B)) ^ (get0(B)) ^ (get63(B)&get60(B)) ^ (get37(B)&get33(B)) ^ (get15(B)&get9(B))^
      (get60(B)&get52(B)&get45(B)) ^ (get33(B)&get28(B)&get21(B)) ^ (get63(B)&get45(B)&get28(B)&get9(B))^
      (get60(B)&get52(B)&get37(B)&get33(B)) ^ (get63(B)&get60(B)&get21(B)&get15(B))^
      (get63(B)&get60(B)&get52(B)&get45(B)&get37(B)) ^ (get33(B)&get28(B)&get21(B)&get15(B)&get9(B))^
      (get52(B)&get45(B)&get37(B)&get33(B)&get28(B)&get21(B));

#else

   u32 B33_28_21 = (get33(B)&get28(B)&get21(B));   /* 3 */
   u32 B52_45_37 = (get52(B)&get45(B)&get37(B));   /* 2 */
   u32 B52_37_33 = (get52(B)&get37(B)&get33(B));   /* 2 */
   u32 B60_52_45 = (get60(B)&get52(B)&get45(B));   /* 2 */
   u32 B63_60 = (get63(B)&get60(B));	/* 3 */
   u32 B37_33 = (get37(B)&get33(B));	/* 3 */
   u32 B45_28 = (get45(B)&get28(B));	/* 2 */
   u32 B15_9  = (get15(B)&get9(B));	/* 2 */
   u32 B21_15 = (get21(B)&get15(B));	/* 2 */

   u32 B80 =(get0(S)) ^ (get62(B)) ^ (get60(B)) ^ (get52(B)) ^ (get45(B)) ^ (get37(B)) ^ (get33(B)) ^ (get28(B)) ^ (get21(B))^
      (get14(B)) ^ (get9(B)) ^ (get0(B)) ^ (B63_60) ^ (B37_33) ^ (B15_9)^
      (B60_52_45) ^ (B33_28_21) ^ (get63(B)&B45_28&get9(B))^
      (get60(B)&B52_37_33) ^ (B63_60&B21_15)^
      (B63_60&B52_45_37) ^ (B33_28_21&B15_9)^
      (B52_45_37&B33_28_21);
#endif



   SHIFT_FSR(S);
   SHIFT_FSR(B);
   set79(S,S80);
   set79(B,B80);

   return Z&1;
}
Exemplo n.º 7
0
int main()
{
	void (*greet)();
	int (*printit)(const char*, ...);
	
	greetings();
	printf("get: %d\n", get3());
	
	greet = dlsym(RTLD_DEFAULT, "greetings");		// search all objects for the given symbol
	greet();
	
	printit = dlsym(RTLD_DEFAULT, "printf");			// from libc
	printit("libc\n");
	
	return 0;
}
Exemplo n.º 8
0
 DWORD   GetStreamId()		{ return get3(data,8); }
Exemplo n.º 9
0
 DWORD   GetTimestamp()      	{ return get3(data,4); }
Exemplo n.º 10
0
 DWORD   GetDataSize()  		{ return get3(data,1); }
Exemplo n.º 11
0
void skippage()                /* skip past one page */
{
    register int opcode;

    while ((opcode = (int) get1()) != EOP) {
        if (opcode > POST_POST)
            errorexit(illop);
        else
            switch (opcode) {
                case SET1     :
                case PUT1     :
                case RIGHT1   :
                case W1       :
                case X1       :
                case DOWN1    :
                case Y1       :
                case Z1       : /* assume FNT change can also be skipped */
                case FNT1     : mseek(DVIfile, 1L, relative); break;
                case SET2     :
                case PUT2     :
                case RIGHT2   :
                case W2       :
                case X2       :
                case DOWN2    :
                case Y2       :
                case Z2       :
                case FNT2     : mseek(DVIfile, 2L, relative); break;
                case SET3     :
                case PUT3     :
                case RIGHT3   :
                case W3       :
                case X3       :
                case DOWN3    :
                case Y3       :
                case Z3       :
                case FNT3     : mseek(DVIfile, 3L, relative); break;
                case SET4     :
                case PUT4     :
                case RIGHT4   :
                case W4       :
                case X4       :
                case DOWN4    :
                case Y4       :
                case Z4       :
                case FNT4     : mseek(DVIfile, 4L, relative); break;
                case SET_RULE :
                case PUT_RULE : mseek(DVIfile, 8L, relative); break;
                case BOP      : errorexit(bdbop); break;
                case XXX1     : mseek(DVIfile, get1(), relative); break;
                case XXX2     : mseek(DVIfile, get2(), relative); break;
                case XXX3     : mseek(DVIfile, get3(), relative); break;
                case XXX4     : mseek(DVIfile, get4(), relative); break;
                case FNT_DEF1 :
                case FNT_DEF2 :
                case FNT_DEF3 :
                case FNT_DEF4 : fontdef(opcode - FNT_DEF1 + 1); break;
                case PRE      : errorexit(bdpre); break;
                case POST     : errorexit(bdpst); break;
                case POST_POST: errorexit(bdpp); break;
        }
    }

} /* skippage */
Exemplo n.º 12
0
void dopage()
{

    while ((opcode = (int) get1()) != EOP) {    /* process page until eop */
        if (opcode <= LASTCHAR)
            dochar((char) opcode);
        else if ((opcode >= FONT_00) && (opcode <= FONT_63)) 
            setfont(opcode - FONT_00);
        else if (opcode > POST_POST)
            errorexit(illop);
        else
            switch (opcode) {
                case SET1     : setchar(get1()); break;
                case SET2     : setchar(get2()); break;
                case SET3     : setchar(get3()); break;
                case SET4     : setchar(get4()); break;
                case SET_RULE : { long height = sget4();
                                  rule(MOVE, sget4(), height); break;
                                }
                case PUT1     : putcharacter(get1()); break;
                case PUT2     : putcharacter(get2()); break;
                case PUT3     : putcharacter(get3()); break;
                case PUT4     : putcharacter(get4()); break;
                case PUT_RULE : { long height = sget4();
                                  rule(STAY, sget4(), height); break;
                                }
                case NOP      : break;  /* no-op */
                case BOP      : errorexit(bdbop); break;
/*              case EOP      : break;  strange place to have EOP */
                case PUSH     : if (sptr >= stackmax)            /* push */
                                     errorexit(stkof);
                                stack[sptr].hh = h;
                                stack[sptr].vv = v;
                                stack[sptr].ww = w;
                                stack[sptr].xx = x;
                                stack[sptr].yy = y;
                                stack[sptr].zz = z;
                                sptr++;
                                break;
                case POP      : if (sptr == 0)                   /* pop */
                                    errorexit(stkuf);
                                sptr--;
                                h = stack[sptr].hh;
                                v = stack[sptr].vv;
                                w = stack[sptr].ww;
                                x = stack[sptr].xx;
                                y = stack[sptr].yy;
                                z = stack[sptr].zz;
                                break;
                case RIGHT1   : (void) horizontalmove(sget1()); break;
                case RIGHT2   : (void) horizontalmove(sget2()); break;
                case RIGHT3   : (void) horizontalmove(sget3()); break;
                case RIGHT4   : (void) horizontalmove(sget4()); break;
                case W0       : h += w; break;
                case W1       : w = horizontalmove(sget1()); break;
                case W2       : w = horizontalmove(sget2()); break;
                case W3       : w = horizontalmove(sget3()); break;
                case W4       : w = horizontalmove(sget4()); break;
                case X0       : h += x; break;
                case X1       : x = horizontalmove(sget1()); break;
                case X2       : x = horizontalmove(sget2()); break;
                case X3       : x = horizontalmove(sget3()); break;
                case X4       : x = horizontalmove(sget4()); break;
                case DOWN1    : v += sget1(); break;
                case DOWN2    : v += sget2(); break;
                case DOWN3    : v += sget3(); break;
                case DOWN4    : v += sget4(); break;
                case Y0       : v += y; break;
                case Y1       : y = sget1(); v += y; break;
                case Y2       : y = sget2(); v += y; break;
                case Y3       : y = sget3(); v += y; break;
                case Y4       : y = sget4(); v += y; break;
                case Z0       : v += z; break;
                case Z1       : z = sget1(); v += z; break;
                case Z2       : z = sget2(); v += z; break;
                case Z3       : z = sget3(); v += z; break;
                case Z4       : z = sget4(); v += z; break;
                case FNT1     :
                case FNT2     :
                case FNT3     :
                case FNT4     : setfont(num(opcode - FNT1 + 1));
                                break;
                case XXX1     : mseek(DVIfile, get1(), relative); break;
                case XXX2     : mseek(DVIfile, get2(), relative); break;
                case XXX3     : mseek(DVIfile, get3(), relative); break;
                case XXX4     : mseek(DVIfile, get4(), relative); break;
                case FNT_DEF1 :
                case FNT_DEF2 :
                case FNT_DEF3 :
                case FNT_DEF4 : fontdef(opcode - FNT_DEF1 + 1);
                                break;
                case PRE      : errorexit(bdpre); break;
                case POST     : errorexit(bdpst); break;
                case POST_POST: errorexit(bdpp); break;
            }
    }

} /* dopage */
Exemplo n.º 13
0
Arquivo: same.cpp Projeto: herumi/misc
bool is_same11(const uint8_t *p, const uint8_t *q) { return (get8(p) ^ get8(q)) | (get3(p + 8) ^ get3(q + 8)); }
Exemplo n.º 14
0
Arquivo: same.cpp Projeto: herumi/misc
bool is_same3(const uint8_t *p, const uint8_t *q) { return get3(p) ^ get3(q); }
Exemplo n.º 15
0
Arquivo: same.cpp Projeto: herumi/misc
uint64_t get7(const uint8_t *p)
{
	return get4(p) | (get3(p + 4) << 32);
}
Exemplo n.º 16
0
Arquivo: p6.cpp Projeto: 4ntoine/clang
constexpr int *get1() {
  int same_entity = 0; // not the same entity
  {
    extern int same_entity;
    return &same_entity;
  }
}
static_assert(get1() == &same_entity, "failed to find previous decl");

static int same_entity_2[3];
constexpr int *get2() {
  // This is a redeclaration of the same entity, even though it doesn't
  // inherit the type of the prior declaration.
  extern int same_entity_2[];
  return same_entity_2;
}
static_assert(get2() == same_entity_2, "failed to find previous decl");

static int different_entities;
constexpr int *get3() {
  int different_entities = 0;
  {
    // FIXME: This is not a redeclaration of the prior entity, because
    // it is not visible here. Under DR426, this is ill-formed, and without
    // it, the static_assert below should fail.
    extern int different_entities;
    return &different_entities;
  }
}
static_assert(get3() == &different_entities, "failed to find previous decl");