Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
c13029bc
Commit
c13029bc
authored
Nov 20, 1991
by
Dennis Glatting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted hashValue() to a inline.
From-SVN: r64
parent
b1fc2c61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
17 deletions
+22
-17
gcc/objc/hash.c
+22
-17
No files found.
gcc/objc/hash.c
View file @
c13029bc
...
@@ -16,10 +16,17 @@
...
@@ -16,10 +16,17 @@
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*
$Header: /usr/user/dennis_glatting/ObjC/c-runtime/lib/RCS/hash.c,v 0.
3 1991/11/07 23:23:40
dennisg Exp dennisg $
$Header: /usr/user/dennis_glatting/ObjC/c-runtime/lib/RCS/hash.c,v 0.
4 1991/11/19 12:34:41
dennisg Exp dennisg $
$Author: dennisg $
$Author: dennisg $
$Date: 1991/11/
07 23:23:40
$
$Date: 1991/11/
19 12:34:41
$
$Log: hash.c,v $
$Log: hash.c,v $
* Revision 0.4 1991/11/19 12:34:41 dennisg
* bug in hash_delete(). It was using void* to obtain nodes to
* pass to hash_remove(). The value passed to hash_removed() is a
* entry from the node structure rather than the node itself. Using
* void* removed compiler checking.
* Modified to implement cache expansion.
*
* Revision 0.3 1991/11/07 23:23:40 dennisg
* Revision 0.3 1991/11/07 23:23:40 dennisg
* implemented hash table expansion as suggested by rms.
* implemented hash table expansion as suggested by rms.
*
*
...
@@ -52,8 +59,19 @@
...
@@ -52,8 +59,19 @@
#define EXPANSION(cache) \
#define EXPANSION(cache) \
(((cache)->sizeOfHash * 175 ) / 100 )
(((cache)->sizeOfHash * 175 ) / 100 )
/* Local forward decl. */
u_int
hashValue
(
Cache_t
,
void
*
);
static
inline
u_int
hashValue
(
Cache_t
theCache
,
void
*
aKey
)
{
u_int
hash
=
0
;
int
i
;
assert
(
theCache
->
numberOfMaskBits
);
for
(
i
=
0
;
i
<
(
sizeof
(
aKey
)
*
8
);
i
+=
theCache
->
numberOfMaskBits
)
hash
^=
((
u_int
)
aKey
)
>>
i
;
return
(
hash
&
theCache
->
mask
)
%
theCache
->
sizeOfHash
;
}
Cache_t
hash_new
(
u_int
sizeOfHash
)
{
Cache_t
hash_new
(
u_int
sizeOfHash
)
{
...
@@ -299,16 +317,3 @@ CacheNode_t hash_next( Cache_t theCache, CacheNode_t aCacheNode ) {
...
@@ -299,16 +317,3 @@ CacheNode_t hash_next( Cache_t theCache, CacheNode_t aCacheNode ) {
}
}
u_int
hashValue
(
Cache_t
theCache
,
void
*
aKey
)
{
u_int
hash
=
0
;
int
i
;
assert
(
theCache
->
numberOfMaskBits
);
for
(
i
=
0
;
i
<
(
sizeof
(
aKey
)
*
8
);
i
+=
theCache
->
numberOfMaskBits
)
hash
^=
((
u_int
)
aKey
)
>>
i
;
return
(
hash
&
theCache
->
mask
)
%
theCache
->
sizeOfHash
;
}
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