Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
872a3881
Commit
872a3881
authored
Aug 13, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use FNV hash
git-svn-id:
file:///svn/tokudb@116
c7de825b-a66e-492c-adef-691d508d4ae1
parent
690f5c0c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
newbrt/hashtable.c
newbrt/hashtable.c
+14
-0
No files found.
newbrt/hashtable.c
View file @
872a3881
...
@@ -23,6 +23,19 @@ int toku_hashtable_create (HASHTABLE *h) {
...
@@ -23,6 +23,19 @@ int toku_hashtable_create (HASHTABLE *h) {
return
0
;
return
0
;
}
}
// FNV Hash: From an idea sent by Glenn Fowler and Phong Vo to the IEEE POSIX 1003.2 committee. Landon Curt Noll improved it.
// See: http://isthe.com/chongo/tech/comp/fnv/
static
unsigned
int
hash_key
(
const
char
*
key
,
ITEMLEN
keylen
)
{
ITEMLEN
i
;
unsigned
int
hash
=
0
;
for
(
i
=
0
;
i
<
keylen
;
i
++
,
key
++
)
{
hash
*=
16777619
;
hash
^=
*
(
unsigned
char
*
)
key
;
}
return
hash
;
}
#if 0
static unsigned int hash_key (const char *key, ITEMLEN keylen) {
static unsigned int hash_key (const char *key, ITEMLEN keylen) {
/* From Sedgewick. There are probably better hash functions. */
/* From Sedgewick. There are probably better hash functions. */
unsigned int b = 378551;
unsigned int b = 378551;
...
@@ -35,6 +48,7 @@ static unsigned int hash_key (const char *key, ITEMLEN keylen) {
...
@@ -35,6 +48,7 @@ static unsigned int hash_key (const char *key, ITEMLEN keylen) {
}
}
return hash;
return hash;
}
}
#endif
static
void
hash_find_internal
(
HASHTABLE
tab
,
const
char
*
key
,
ITEMLEN
keylen
,
HASHELT
*
hashelt
,
HASHELT
**
prev_ptr
)
{
static
void
hash_find_internal
(
HASHTABLE
tab
,
const
char
*
key
,
ITEMLEN
keylen
,
HASHELT
*
hashelt
,
HASHELT
**
prev_ptr
)
{
unsigned
int
h
=
hash_key
(
key
,
keylen
)
%
tab
->
arraysize
;
unsigned
int
h
=
hash_key
(
key
,
keylen
)
%
tab
->
arraysize
;
...
...
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