Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
5adbacb8
Commit
5adbacb8
authored
Aug 05, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
map.c
src/runtime/map.c
+1
-1
runtime.c
src/runtime/runtime.c
+4
-3
No files found.
src/runtime/map.c
View file @
5adbacb8
...
@@ -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
);
...
...
src/runtime/runtime.c
View file @
5adbacb8
...
@@ -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
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment