Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
e42d6a5f
Commit
e42d6a5f
authored
Jun 26, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add pointer to val type of maps
SVN=124971
parent
3e4e83ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
src/runtime/runtime.c
src/runtime/runtime.c
+33
-2
No files found.
src/runtime/runtime.c
View file @
e42d6a5f
...
@@ -980,6 +980,36 @@ stringcopy(uint32 s, string *a, string *b)
...
@@ -980,6 +980,36 @@ stringcopy(uint32 s, string *a, string *b)
*
a
=
*
b
;
*
a
=
*
b
;
}
}
static
uint64
pointerhash
(
uint32
s
,
void
**
a
)
{
prints
(
"pointerhash
\n
"
);
return
0x12345
;
}
static
uint32
pointerequal
(
uint32
s
,
void
**
a
,
void
**
b
)
{
prints
(
"pointerequal
\n
"
);
return
0
;
}
static
void
pointerprint
(
uint32
s
,
void
**
a
)
{
prints
(
"pointerprint
\n
"
);
}
static
void
pointercopy
(
uint32
s
,
void
**
a
,
void
**
b
)
{
if
(
b
==
nil
)
{
*
a
=
nil
;
return
;
}
*
a
=
*
b
;
}
static
uint32
static
uint32
rnd
(
uint32
n
,
uint32
m
)
rnd
(
uint32
n
,
uint32
m
)
{
{
...
@@ -996,6 +1026,7 @@ algarray[] =
...
@@ -996,6 +1026,7 @@ algarray[] =
{
{
{
&
memhash
,
&
memequal
,
&
memprint
,
&
memcopy
},
{
&
memhash
,
&
memequal
,
&
memprint
,
&
memcopy
},
{
&
stringhash
,
&
stringequal
,
&
stringprint
,
&
stringcopy
},
{
&
stringhash
,
&
stringequal
,
&
stringprint
,
&
stringcopy
},
{
&
pointerhash
,
&
pointerequal
,
&
pointerprint
,
&
pointercopy
},
};
};
// newmap(keysize uint32, valsize uint32,
// newmap(keysize uint32, valsize uint32,
...
@@ -1008,8 +1039,8 @@ sys·newmap(uint32 keysize, uint32 valsize,
...
@@ -1008,8 +1039,8 @@ sys·newmap(uint32 keysize, uint32 valsize,
{
{
Hmap
*
m
;
Hmap
*
m
;
if
(
keyalg
>=
nelem
(
algarray
)
||
if
(
keyalg
>=
2
||
valalg
>=
nelem
(
algarray
)
)
{
valalg
>=
3
)
{
prints
(
"0<="
);
prints
(
"0<="
);
sys
·
printint
(
keyalg
);
sys
·
printint
(
keyalg
);
prints
(
"<"
);
prints
(
"<"
);
...
...
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