aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2008-08-05 11:14:35 -0700
committerRob Pike <r@golang.org>2008-08-05 11:14:35 -0700
commit5adbacb8e7856cd56617e788c112e012303bcb82 (patch)
tree788e4c78b2e69c2ed0d1ce1c8fadf0ad802473e1 /src/runtime
parent033682deec8cf13b4e821e30ef774f843ab1e0d0 (diff)
downloadgo-5adbacb8e7856cd56617e788c112e012303bcb82.tar.xz
allow pointers as keys in maps, treating them the same as ints - ptr eq not value equality
R=ken,gri OCL=13879 CL=13879
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/map.c2
-rw-r--r--src/runtime/runtime.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/src/runtime/map.c b/src/runtime/map.c
index 93a985f15e..f945e8c47b 100644
--- a/src/runtime/map.c
+++ b/src/runtime/map.c
@@ -40,7 +40,7 @@ sys·newmap(uint32 keysize, uint32 valsize,
{
Hmap *m;
- if(keyalg >= 2 ||
+ if(keyalg >= 3 ||
valalg >= 3) {
prints("0<=");
sys·printint(keyalg);
diff --git a/src/runtime/runtime.c b/src/runtime/runtime.c
index 75d23d50d8..ec2951b0af 100644
--- a/src/runtime/runtime.c
+++ b/src/runtime/runtime.c
@@ -777,7 +777,8 @@ pointercopy(uint32 s, void **a, void **b)
Alg
algarray[3] =
{
- { &memhash, &memequal, &memprint, &memcopy },
- { &stringhash, &stringequal, &stringprint, &stringcopy },
- { &pointerhash, &pointerequal, &pointerprint, &pointercopy },
+ { &memhash, &memequal, &memprint, &memcopy }, // 0
+ { &stringhash, &stringequal, &stringprint, &stringcopy }, // 1
+// { &pointerhash, &pointerequal, &pointerprint, &pointercopy }, // 2
+ { &memhash, &memequal, &memprint, &memcopy }, // 2 - treat pointers as ints
};