diff options
author | Keith Randall <khr@golang.org> | 2014-08-07 14:52:55 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2014-08-07 14:52:55 -0700 |
commit | d7592d34609d1d9984f9fce874ac737ede817d90 (patch) | |
tree | 6ca96d486f35348dc21e1c002e1184cf5b4b704f /src/pkg/runtime/iface.goc | |
parent | 4a7c76fae1a96626259334d6c1367a1ea4adb331 (diff) | |
download | go-d7592d34609d1d9984f9fce874ac737ede817d90.tar.gz |
runtime: convert equality functions to Go
LGTM=rsc
R=rsc, khr
CC=golang-codereviews
https://codereview.appspot.com/121330043
Diffstat (limited to 'src/pkg/runtime/iface.goc')
-rw-r--r-- | src/pkg/runtime/iface.goc | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/pkg/runtime/iface.goc b/src/pkg/runtime/iface.goc index a2e968faf..2ac740590 100644 --- a/src/pkg/runtime/iface.goc +++ b/src/pkg/runtime/iface.goc @@ -153,49 +153,3 @@ runtime·ifaceE2I2(InterfaceType *inter, Eface e, Iface *ret) ret->data = e.data; return true; } - -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; -} - -bool -runtime·ifaceeq_c(Iface i1, Iface i2) -{ - if(i1.tab != i2.tab) - return false; - if(i1.tab == nil) - return true; - return ifaceeq1(i1.data, i2.data, i1.tab->type); -} - -bool -runtime·efaceeq_c(Eface e1, Eface e2) -{ - if(e1.type != e2.type) - return false; - if(e1.type == nil) - return true; - return ifaceeq1(e1.data, e2.data, e1.type); -} |