int main(int argc, char *argv[])
{
  Pooma::initialize(argc,argv);
  Pooma::Tester tester(argc,argv);

  tester.out() << "Starting IndirectionList test." << std::endl << std::endl;

  Interval<1> foo(0,6);

  Array<1,int,Brick> klist(foo);

  klist = 1;
  Pooma::blockAndEvaluate();

  for(int i=1;i<7;i++)
    klist(i) = klist(i-1)+i;
  klist(2)=3;
  klist(5)=12;
  klist(6)=20;
  
  tester.out() << klist << std::endl;

  Interval<1> fff(0,20);

  DynamicArray<double,Dynamic> goo(fff),roo(fff);
  for(int i=0;i<=goo.domain().last();i++)
    goo(i)=roo(i)=i;

  IndirectionList<int> iklist(klist);

  tester.out()  << " iklist.first() = " << iklist.first() << std::endl;
  tester.out()  << " iklist.last() = " << iklist.last() << std::endl;
  tester.out()  << " iklist.size() = " << iklist.size() << std::endl;
  
  tester.out() << "DynamicArray to be altered" << goo << std::endl;

  Range<1> sss(0,3);
	
  goo.destroy(iklist,ShiftUp());

  tester.out() << "after destroy with ShiftUp" << std::endl;
  tester.out() << goo << std::endl;


  roo.destroy(iklist,BackFill());
  tester.out() << "after destroy with BackFill" << std::endl;
  tester.out() << roo << std::endl;

  tester.out() << "Finished IndirectionList test." << std::endl << std::endl;

  int res = tester.results("indirectionlist_test1");
  Pooma::finalize();
  return res;
}
Exemplo n.º 2
0
int main()
{
	int n = 10;
	const int c = n;
	const int& r = c;

	foo(n); // T : int				a : int&
	foo(c); // T : const int		a : const int&
	foo(r); // T : const int		a : const int&

	goo(n); // T : int				a : const int&
	goo(c); // T : int				a : const int&
	goo(r); // T : int				a : cosnt int&
}
Exemplo n.º 3
0
void iuse::marloss(game *g, player *p, item *it, bool t)
{
 if (p->is_npc())
  return;
// If we have the marloss in our veins, we are a "breeder" and will spread
// alien lifeforms.
 if (p->has_trait(PF_MARLOSS)) {
  g->add_msg("As you eat the berry, you have a near-religious experience, feeling at one with your surroundings...");
  p->add_morale(MORALE_MARLOSS, 250, 1000);
  p->hunger = -100;
  monster goo(g->mtypes[mon_blob]);
  goo.friendly = -1;
  int goo_spawned = 0;
  for (int x = p->posx - 4; x <= p->posx + 4; x++) {
   for (int y = p->posy - 4; y <= p->posy + 4; y++) {
    if (rng(0, 10) > trig_dist(x, y, p->posx, p->posy) &&
        rng(0, 10) > trig_dist(x, y, p->posx, p->posy)   )
     g->m.marlossify(x, y);
    if (one_in(10 + 5 * trig_dist(x, y, p->posx, p->posy)) &&
        (goo_spawned == 0 || one_in(goo_spawned * 2))) {
     goo.spawn(x, y);
     g->z.push_back(goo);
     goo_spawned++;
    }
   }
  }
  return;
 }
/* If we're not already carriers of Marloss, roll for a random effect:
 * 1 - Mutate
 * 2 - Mutate
 * 3 - Mutate
 * 4 - Purify
 * 5 - Purify
 * 6 - Cleanse radiation + Purify
 * 7 - Fully satiate
 * 8 - Vomit
 * 9 - Give Marloss mutation
 */
 int effect = rng(1, 9);
 if (effect <= 3) {
  g->add_msg("This berry tastes extremely strange!");
  p->mutate(g);
 } else if (effect <= 6) { // Radiation cleanse is below
  g->add_msg("This berry makes you feel better all over.");
  p->pkill += 30;
  this->purifier(g, p, it, t);
 } else if (effect == 7) {
  g->add_msg("This berry is delicious, and very filling!");
  p->hunger = -100;
 } else if (effect == 8) {
  g->add_msg("You take one bite, and immediately vomit!");
  p->vomit(g);
 } else if (!p->has_trait(PF_MARLOSS)) {
  g->add_msg("You feel a strange warmth spreading throughout your body...");
  p->toggle_trait(PF_MARLOSS);
 }
 if (effect == 6)
  p->radiation = 0;
}
Exemplo n.º 4
0
Arquivo: simd-6.c Projeto: pjump/gcc
int myaddfloat_ref(float *x, float *y, int n)
{
    for (int i=0; i<n; i++) {
        x[i] = (x[i] > y[i]) ? goo(&y[i]) : y[i];
    }
    return x[n-1];
}
Exemplo n.º 5
0
/* Address computation based on a function frame address. */
int
foo3 ()
{
  int a;
  int *p;
  p = &a + 5;
  return goo (p);
}
Exemplo n.º 6
0
   int32_t foo (std::unique_lock <std::mutex>& guard) noexcept {
      if (m_fooCounter == 5) {
         m_fooCounter = 0;
         return goo (guard);
      }

      return ++ m_fooCounter;
   }
Exemplo n.º 7
0
/* Function frame address escaped via global variable. */
int
foo7 ()
{
  int a;
  pg0 = &a;
  goo (pg0);
  return *pg0;
}
Exemplo n.º 8
0
void foo( PODS __near & np
        , PODS __far  & fp
        , NONPODS __near & nn
        , NONPODS __far & fn )
{
    np = np;
    fp = fp;
    np = fp;
    fp = np;

    nn = nn;
    fn = fn;
    nn = fn;
    fn = nn;

    np.~PODS();
    fp.~PODS();

    nn.~NONPODS();
    fn.~NONPODS();

    PODS pa = np;
    PODS pb = fp;

    NONPODS na = nn;
    NONPODS nb = fn;

    poo( nn );
    poo( fn );

    poo( np );
    poo( fp );

    goo( nn );
    goo( fn );

    goo( np );
    goo( fp );

    boo( nn );
    boo( fn );

    boo( np );
    boo( fp );
}
Exemplo n.º 9
0
Arquivo: simd-6.c Projeto: pjump/gcc
int myaddfloat(float *x, float *y, int n)
{
    #pragma omp simd
    for (int i=0; i<n; i++) {
        x[i] = (x[i] > y[i]) ? goo(&y[i]) : y[i];
        /* goo is called under the condition (or within a branch) */
    }
    return x[n-1];
}
Exemplo n.º 10
0
int main()
{
  int a{5};
  int & b{a};
  foo(25);            //foo(const int & a)  
  foo(a);             //foo(int & a)        
  foo(b);             //foo(int & a)        
  foo(createFive());  //foo(const int & a)  
  goo(25);            //goo(int && a) NOTE!      
  goo(a);             //goo(int & a)        
  goo(createFive());  //goo(int && a) NOTE!       
  goo(b);             //goo(int & a)       

  //int& c=createFive(); // ERROR! Cannot bind a temporary to a non-const reference
  const int& c=createFive(); //Ok lifetime of temporary is increased!
  foo(c);  //foo(const int & a)
  goo(c);  //goo(const int & a)
  std::cout<<c<<std::endl;
}
Exemplo n.º 11
0
int main(void)
{
	struct A a = { 4, 6.67 }, b;

	foo(&a);
	printf("00%d.%.3lf.111\n", a.x, a.r);
	b = goo(a);
	printf("00%d.%.3lf.112\n", a.x, a.r);
	printf("%d.%.3lf.113\n", b.x, b.r);
}
Exemplo n.º 12
0
int foo() {
 int a;

 setjmp(env);
 if (cond2)
   a = goo();
 else
   a = 3;
 return a;
}
Exemplo n.º 13
0
 int
main(void)
{
	double d, z[4];
	int i, nbad;

	static ADVar a, b, c, x, y, *v[3] = {&a, &b, &c};
	static ADVar **V[4] = {v, v+1, v+2, v};
	static size_t np[4] = {1, 1, 1, 3};
	static double w[3] = { 1., 1., 1. };
	static double *W[4] = {w, w, w, w};

	nbad = 0;
	for(d = 1.; d <= 2.; ++d) {
		printf("\nd = %g\n", d);
		x = 2;
		y = 3;
		a = foo(d,x,y);
		b = goo(d,x,y);
		c = a + b;

		ADVar::Outvar_Gradcomp(a);
		printf("a = %g\n", a.val());
		printf("da/dx = %g\n", x.adj());
		printf("da/dy = %g\n", y.adj());
		nbad += acheck(0, d, a.val(), x.adj(), y.adj());
		z[0] = a.val();

		ADVar::Outvar_Gradcomp(b);
		printf("b = %g\n", b.val());
		printf("db/dx = %g\n", x.adj());
		printf("db/dy = %g\n", y.adj());
		nbad += acheck(1, d, b.val(), x.adj(), y.adj());
		z[1] = b.val();

		ADVar::Outvar_Gradcomp(c);
		printf("c = %g (should be a + b)\n", c.val());
		printf("dc/dx = %g\n", x.adj());
		printf("dc/dy = %g\n", y.adj());
		nbad += acheck(2, d, c.val(), x.adj(), y.adj());
		z[2] = c.val();
		z[3] = z[0] + z[1] + z[2];

		ADVar::Weighted_GradcompVec(4,np,V,W);
		for(i = 0; i < 4; ++i) {
			printf("w %d:\td/dx = %g\td/dy = %g\n", i, x.adj(i), y.adj(i));
			nbad += acheck(i, d, z[i], x.adj(i), y.adj(i));
			}
		}
	if (nbad == 0)
		printf("\nExample passed!\n");
	else
		printf("\nSomething is wrong, example failed!\n");
	return nbad > 0;
	}
Exemplo n.º 14
0
int main()
{
	int* k;
	int* p;
	k = foo();
	printf("*k: %d, k: %08X\n", *k, k);
	p = goo();
	printf("*p: %d, p: %08X\n", *p, p);
	printf("*k: %d\n", *k);
	printf("*p: %d\n", *p);
}
Exemplo n.º 15
0
void foo(int *p, int flag, int c){
	if(flag == 0 && c < 0)
		return;

	if(flag == 0){
		p = PLKLEAKFP(1);
		flag = 1;
	}

	goo(p,flag,c);
}
Exemplo n.º 16
0
int main(){

  create(&q);
  enqueue(&q, 0);

  $proc p0,p1;

  p0=$spawn foo();
  p1=$spawn goo();
  $wait(p0);
  $wait(p1);
}
Exemplo n.º 17
0
void foo() {
  unsigned i;
  for (i = 0; i <= M; i++) {
    if (cond1) {
      goo();
    } else if (cond2) {
      hoo();
    } else {
      ioo();
    }
  }
}
Exemplo n.º 18
0
void TestGooString::testInsertData()
{
    QFETCH(QByteArray, string);
    QFETCH(QByteArray, addition);
    QFETCH(int, position);
    QFETCH(QByteArray, result);

    GooString goo(string.constData());
    QCOMPARE(goo.getCString(), string.constData());
    goo.insert(position, addition.constData());
    QCOMPARE(goo.getCString(), result.constData());
}
Exemplo n.º 19
0
int main() {
  foo();
  goo();

  void (*f)() = &goo;

  int n;
  cin >> n;
  if (n == 0) f = &foo;

  f();
}
Exemplo n.º 20
0
int main()
{
    int n1 = 10;
    int n2 = 20;

    n1 = 10;
    10 = n1; // error. 10은 rvalue 이다

    n2 = n1;

    foo() = 20; // error. 값을 리턴하는 함수, 임시객체생성, rvalue
    goo() = 20; //
}
Exemplo n.º 21
0
void main()
{
	int arr[3] = { 1,3,5};			
	int i;
	foo( arr );		// 2. call by reference
	woo( arr + 1);
	goo( arr[1]);	// call by value

	for(i=0; i<3; i++)
	{
		printf("arr[%d] = %d\n", i, arr[i]);
	}
}
Exemplo n.º 22
0
void foo() {
  int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15;
  unsigned i, j;

  r1 = a[1];
  r2 = a[2];
  r3 = a[3];
  r4 = a[4];
  r5 = a[5];
  r6 = a[6];
  r7 = a[7];
  r8 = a[8];
  r9 = a[9];
  r10 = a[10];
  r11 = a[11];
  r12 = a[12];
  r13 = a[13];
  r14 = a[14];
  r15 = a[15];
  if (cond1)
    hoo();
  b[1] = r1;
  b[2] = r2;
  b[3] = r3;
  b[4] = r4;
  b[5] = r5;
  b[6] = r6;
  b[7] = r7;
  b[8] = r8;
  b[9] = r9;
  b[10] = r10;
  b[11] = r11;
  b[12] = r12;
  b[13] = r13;
  b[14] = r14;
  b[15] = r15;

  for (i = 0; i < M; i++) {
    r1 = x;
    goo();
    y = r1;
    if (cond1) {
      for (j = 0; j < N; j++) {
        r2 = a[j];
        hoo();
        b[j] = r2;
      }
    }
  }
}
int main(int argc, char * argv[])
{
    const int N = 6400;
    int i;

    float *pdZ;

    if (posix_memalign((void **)&pdZ, 64, N * sizeof(float)) != 0)
    {
        exit(1);
    }

    goo(pdZ, N);

    return 0;
}
int main (int argc, char* argv[])
{
        // this doesn't work
        Base* obj = new Derived;
        
        // neither does this
        goo(obj);

        // nor this
        if (dynamic_cast<Derived>(obj)) {
                std::cout << "Whoosh...";
        }

        // the whole thing simply fails to compile
        delete obj;

        return 0;
}
Exemplo n.º 25
0
task main()
{
  initializeRobot();
goo();
 StartTask(read);
//StartTask(seek);
StartTask(store);
StartTask(count);
StartTask(newi);
while (true)
  {

 //servo[servo1] = 160;
 nxtDisplayCenteredTextLine(1,"goo2= %d",goo2);
 nxtDisplayCenteredTextLine(3,"rtest= %d",r1);
nxtDisplayCenteredTextLine(2,"Ir= %d",rir);



  }
}
Exemplo n.º 26
0
void foo() {
  int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15;
  int i, j;

  r15 = a[15];
  for (i = 0; i < M; i++) {
    if (__builtin_expect(cond1, 0))
      if (__builtin_expect(cond2, 0))
          goo();
    r1 = a[1];
    r2 = a[2];
    r3 = a[3];
    r4 = a[4];
    r5 = a[5];
    r6 = a[6];
    r7 = a[7];
    r8 = a[8];
    r9 = a[9];
    r10 = a[10];
    r11 = a[11];
    r12 = a[12];
    asm volatile ("" : : : "memory");
    b[14] = a[14];
    asm volatile ("" : : : "memory");
    b[1] = r1;
    b[2] = r2;
    b[3] = r3;
    b[4] = r4;
    b[5] = r5;
    b[6] = r6;
    b[7] = r7;
    b[8] = r8;
    b[9] = r9;
    b[10] = r10;
    b[11] = r11;
    b[12] = r12;
  }
  b[15] = r15;
}
Exemplo n.º 27
0
/* Address computaton based on a function frame address.*/
int
foo6 ()
{
  struct BB bb;
  return goo (&bb.one + sizeof(int));
}
Exemplo n.º 28
0
/* Address cast based on a local array. */
int
foo5 ()
{
  short array[10];
  return goo ((int *)(array + 5));
}
Exemplo n.º 29
0
/* Address cast based on a function frame address. */
int
foo4 ()
{
  int a;
  return goo (g0 << 2 ? (int *)(3 * (long)(void *)(&a)) : 0);
}
Exemplo n.º 30
0
/* Function frame address escaped function call. */
int
foo1 ()
{
  int i;
  return goo (&i);
}