aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-01-26 12:36:21 -0800
committerRuss Cox <rsc@golang.org>2009-01-26 12:36:21 -0800
commit9b6d385cb59879f699cec7af72af1081b423d885 (patch)
tree2510d5aae07204aade67d94379f589f3c9bb7738 /src/runtime/runtime.c
parent7859ae8a2f5f5b48d5961df7c6e84ce7d7c3c46b (diff)
downloadgo-9b6d385cb59879f699cec7af72af1081b423d885.tar.xz
interface speedups and fixes.
more caching, better hash functions, proper locking. fixed a bug in interface comparison too. R=ken DELTA=177 (124 added, 10 deleted, 43 changed) OCL=23491 CL=23493
Diffstat (limited to 'src/runtime/runtime.c')
-rw-r--r--src/runtime/runtime.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c
index ce9349383c..00e3638ab9 100644
--- a/src/runtime/runtime.c
+++ b/src/runtime/runtime.c
@@ -69,6 +69,24 @@ mcpy(byte *t, byte *f, uint32 n)
}
}
+int32
+mcmp(byte *s1, byte *s2, uint32 n)
+{
+ uint32 i;
+ byte c1, c2;
+
+ for(i=0; i<n; i++) {
+ c1 = s1[i];
+ c2 = s2[i];
+ if(c1 < c2)
+ return -1;
+ if(c1 > c2)
+ return +1;
+ }
+ return 0;
+}
+
+
void
mmov(byte *t, byte *f, uint32 n)
{
@@ -368,6 +386,23 @@ noequal(uint32 s, void *a, void *b)
return 0;
}
+static void
+noprint(uint32 s, void *a)
+{
+ USED(s);
+ USED(a);
+ throw("print of unprintable type");
+}
+
+static void
+nocopy(uint32 s, void *a, void *b)
+{
+ USED(s);
+ USED(a);
+ USED(b);
+ throw("copy of uncopyable type");
+}
+
Alg
algarray[] =
{
@@ -375,5 +410,6 @@ algarray[] =
[ANOEQ] { nohash, noequal, memprint, memcopy },
[ASTRING] { strhash, strequal, strprint, memcopy },
[AINTER] { interhash, interequal, interprint, memcopy },
+[AFAKE] { nohash, noequal, noprint, nocopy },
};