Commit 5adbacb8 authored by Rob Pike's avatar Rob Pike

allow pointers as keys in maps, treating them the same as ints - ptr eq not value equality

R=ken,gri
OCL=13879
CL=13879
parent 033682de
...@@ -40,7 +40,7 @@ sys·newmap(uint32 keysize, uint32 valsize, ...@@ -40,7 +40,7 @@ sys·newmap(uint32 keysize, uint32 valsize,
{ {
Hmap *m; Hmap *m;
if(keyalg >= 2 || if(keyalg >= 3 ||
valalg >= 3) { valalg >= 3) {
prints("0<="); prints("0<=");
sys·printint(keyalg); sys·printint(keyalg);
......
...@@ -777,7 +777,8 @@ pointercopy(uint32 s, void **a, void **b) ...@@ -777,7 +777,8 @@ pointercopy(uint32 s, void **a, void **b)
Alg Alg
algarray[3] = algarray[3] =
{ {
{ &memhash, &memequal, &memprint, &memcopy }, { &memhash, &memequal, &memprint, &memcopy }, // 0
{ &stringhash, &stringequal, &stringprint, &stringcopy }, { &stringhash, &stringequal, &stringprint, &stringcopy }, // 1
{ &pointerhash, &pointerequal, &pointerprint, &pointercopy }, // { &pointerhash, &pointerequal, &pointerprint, &pointercopy }, // 2
{ &memhash, &memequal, &memprint, &memcopy }, // 2 - treat pointers as ints
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment