Beispiel #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;
}
Beispiel #2
0
void
__go_panic_msg (const char* msg)
{
  size_t len;
  unsigned char *sdata;
  struct __go_string s;
  struct __go_empty_interface arg;

  len = __builtin_strlen (msg);
  sdata = runtime_mallocgc (len, FlagNoPointers, 0, 0);
  __builtin_memcpy (sdata, msg, len);
  s.__data = sdata;
  s.__length = len;
  newErrorString(s, &arg);
  __go_panic (arg);
}
Beispiel #3
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; 
} 
Beispiel #4
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; 
} 
Beispiel #5
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;
}
Beispiel #6
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; 
}