Exemplo n.º 1
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.º 2
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;
}