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,
{
Hmap *m;
if(keyalg >= 2 ||
if(keyalg >= 3 ||
valalg >= 3) {
prints("0<=");
sys·printint(keyalg);
......
......@@ -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
};
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