Exemplo n.º 1
0
static bool
ifaceeq1(void *data1, void *data2, Type *t)
{
	uintptr size;
	Alg *alg;
	Eface err;
	bool eq;

	alg = t->alg;
	size = t->size;

	if(alg->equal == runtime·noequal) {
		// calling noequal will panic too,
		// but we can print a better error.
		runtime·newErrorString(runtime·catstring(runtime·gostringnocopy((byte*)"comparing uncomparable type "), *t->string), &err);
		runtime·panic(err);
	}

	eq = 0;
	if(size <= sizeof(data1))
		alg->equal(&eq, size, &data1, &data2);
	else
		alg->equal(&eq, size, data1, data2);
	return eq;
}
Exemplo n.º 2
0
static void 
copyout ( Type *t , void **src , void *dst ) 
{ 
uintptr size; 
Alg *alg; 
#line 162 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
size = t->size; 
alg = t->alg; 
#line 165 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
if ( size <= sizeof ( *src ) ) 
alg->copy ( size , dst , src ) ; 
else 
alg->copy ( size , dst , *src ) ; 
} 
Exemplo n.º 3
0
static void
copyout(Type *t, void **src, void *dst)
{
	uintptr size;
	Alg *alg;

	size = t->size;
	alg = t->alg;

	if(size <= sizeof(*src))
		alg->copy(size, dst, src);
	else
		alg->copy(size, dst, *src);
}
Exemplo n.º 4
0
int main(){
    ifstream R_file("R.txt");
    ifstream S_file("S.txt");
    string line_R,line_S;
    while(getline(R_file,line_R)&&getline(S_file,line_S)){
        Alg* com = new Alg;
        com->parse(line_R,true);
        com->parse(line_S,false);
        com->compute();
        cout<<com->getType()<<endl;	
	delete com;
    }
    return 0;
}
Exemplo n.º 5
0
static void 
copyout ( Type *t , void **src , void *dst ) 
{ 
uintptr size; 
Alg *alg; 
#line 176 "/home/14/ren/source/golang/go/src/pkg/runtime/iface.goc"
size = t->size; 
alg = t->alg; 
#line 179 "/home/14/ren/source/golang/go/src/pkg/runtime/iface.goc"
if ( size <= sizeof ( *src ) ) 
alg->copy ( size , dst , src ) ; 
else 
alg->copy ( size , dst , *src ) ; 
} 
Exemplo n.º 6
0
static void 
copyout ( Type *t , void **src , void *dst ) 
{ 
uintptr size; 
Alg *alg; 
#line 176 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
size = t->size; 
alg = t->alg; 
#line 179 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
if ( size <= sizeof ( *src ) ) 
alg->copy ( size , dst , src ) ; 
else 
alg->copy ( size , dst , *src ) ; 
} 
Exemplo n.º 7
0
static void 
copyin ( Type *t , void *src , void **dst ) 
{ 
uintptr size; 
void *p; 
Alg *alg; 
#line 144 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
size = t->size; 
alg = t->alg; 
#line 147 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
if ( size <= sizeof ( *dst ) ) 
alg->copy ( size , dst , src ) ; 
else { 
p = runtime·mal ( size ) ; 
alg->copy ( size , p , src ) ; 
*dst = p; 
} 
} 
Exemplo n.º 8
0
static void
copyin(Type *t, void *src, void **dst)
{
	uintptr size;
	void *p;
	Alg *alg;

	size = t->size;
	alg = t->alg;

	if(size <= sizeof(*dst))
		alg->copy(size, dst, src);
	else {
		p = runtime·mal(size);
		alg->copy(size, p, src);
		*dst = p;
	}
}
Exemplo n.º 9
0
static void 
copyin ( Type *t , void *src , void **dst ) 
{ 
uintptr size; 
void *p; 
Alg *alg; 
#line 158 "/home/14/ren/source/golang/go/src/pkg/runtime/iface.goc"
size = t->size; 
alg = t->alg; 
#line 161 "/home/14/ren/source/golang/go/src/pkg/runtime/iface.goc"
if ( size <= sizeof ( *dst ) ) 
alg->copy ( size , dst , src ) ; 
else { 
p = runtime·mal ( size ) ; 
alg->copy ( size , p , src ) ; 
*dst = p; 
} 
} 
Exemplo n.º 10
0
static void 
copyin ( Type *t , void *src , void **dst ) 
{ 
uintptr size; 
void *p; 
Alg *alg; 
#line 158 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
size = t->size; 
alg = t->alg; 
#line 161 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
if ( size <= sizeof ( *dst ) ) 
alg->copy ( size , dst , src ) ; 
else { 
p = runtime·cnew ( t ) ; 
alg->copy ( size , p , src ) ; 
*dst = p; 
} 
} 
Exemplo n.º 11
0
        void adjustBounds(
            Particle const& particle,
            PositionIter posIter,
            Alg const& alg,
            Generator& gen
        ) const {
            if(gen() < CMCR_) {
                if(gen() < PAR_) {
                    // not sure if this is exactly what was meant... but it seems to make sense.
                    moveParticleInbounds(posIter, alg.getBounds(), jitter_, gen);
                } else {
                    // use a previous good particle.
                    Particle const&
                        p(alg.getReplacementParticle());

                    std::copy(p.beginPosition(), p.endPosition(), posIter);
                    moveParticleSlightly(posIter, alg.getBounds(), jitter_, gen); // I don't think they did this bit.
                }
            } else {
                // select a new random position.
                generateRandomPosition(alg.getBounds().begin(), alg.getBounds().end(), posIter, gen);
            }
        }
Exemplo n.º 12
0
static uintptr 
ifacehash1 ( void *data , Type *t , uintptr h ) 
{ 
Alg *alg; 
uintptr size; 
Eface err; 
#line 464 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
if ( t == nil ) 
return 0; 
#line 467 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
alg = t->alg; 
size = t->size; 
if ( alg->hash == runtime·nohash ) { 
#line 472 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
runtime·newErrorString ( runtime·catstring ( runtime·gostringnocopy ( ( byte* ) "hash of unhashable type " ) , *t->string ) , &err ) ; 
runtime·panic ( err ) ; 
} 
if ( size <= sizeof ( data ) ) 
alg->hash ( &h , size , &data ) ; 
else 
alg->hash ( &h , size , data ) ; 
return h; 
} 
Exemplo n.º 13
0
static bool 
ifaceeq1 ( void *data1 , void *data2 , Type *t ) 
{ 
uintptr size; 
Alg *alg; 
Eface err; 
bool eq; 
#line 504 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
alg = t->alg; 
size = t->size; 
#line 507 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
if ( alg->equal == runtime·noequal ) { 
#line 510 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
runtime·newErrorString ( runtime·catstring ( runtime·gostringnocopy ( ( byte* ) "comparing uncomparable type " ) , *t->string ) , &err ) ; 
runtime·panic ( err ) ; 
} 
#line 514 "/home/pi/go_build/hg/go/src/pkg/runtime/iface.goc"
eq = 0; 
if ( size <= sizeof ( data1 ) ) 
alg->equal ( &eq , size , &data1 , &data2 ) ; 
else 
alg->equal ( &eq , size , data1 , data2 ) ; 
return eq; 
} 
Exemplo n.º 14
0
static uintptr
ifacehash1(void *data, Type *t, uintptr h)
{
	Alg *alg;
	uintptr size;
	Eface err;

	if(t == nil)
		return 0;

	alg = t->alg;
	size = t->size;
	if(alg->hash == runtime·nohash) {
		// calling nohash will panic too,
		// but we can print a better error.
		runtime·newErrorString(runtime·catstring(runtime·gostringnocopy((byte*)"hash of unhashable type "), *t->string), &err);
		runtime·panic(err);
	}
	if(size <= sizeof(data))
		alg->hash(&h, size, &data);
	else
		alg->hash(&h, size, data);
	return h;
}
Exemplo n.º 15
0
static bool 
ifaceeq1 ( void *data1 , void *data2 , Type *t ) 
{ 
uintptr size; 
Alg *alg; 
Eface err; 
bool eq; 
#line 533 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
alg = t->alg; 
size = t->size; 
#line 536 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
if ( alg->equal == runtime·noequal ) { 
#line 539 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
runtime·newErrorString ( runtime·catstring ( runtime·gostringnocopy ( ( byte* ) "comparing uncomparable type " ) , *t->string ) , &err ) ; 
runtime·panic ( err ) ; 
} 
#line 543 "/tmp/makerelease197226928/go/src/pkg/runtime/iface.goc"
eq = 0; 
if ( size <= sizeof ( data1 ) ) 
alg->equal ( &eq , size , &data1 , &data2 ) ; 
else 
alg->equal ( &eq , size , data1 , data2 ) ; 
return eq; 
}