projects
/
sort-networks.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bb13a18
)
src/sn_hashtable.c: Use a 40-bit hashtable.
author
Florian Forster
<octo@leeloo.octo.it>
Mon, 17 Jan 2011 09:54:55 +0000
(10:54 +0100)
committer
Florian Forster
<octo@leeloo.octo.it>
Mon, 17 Jan 2011 09:54:55 +0000
(10:54 +0100)
src/sn_hashtable.c
patch
|
blob
|
history
diff --git
a/src/sn_hashtable.c
b/src/sn_hashtable.c
index
4efb76e
..
3d0fd2d
100644
(file)
--- a/
src/sn_hashtable.c
+++ b/
src/sn_hashtable.c
@@
-69,7
+69,7
@@
void sn_hashtable_destroy (sn_hashtable_t *ht) /* {{{ */
{
int i;
{
int i;
- for (i = 0; i <
25
6; i++)
+ for (i = 0; i <
6553
6; i++)
{
int j;
{
int j;
@@
-100,8
+100,8
@@
void sn_hashtable_destroy (sn_hashtable_t *ht) /* {{{ */
int sn_hashtable_account (sn_hashtable_t *ht, const sn_network_t *n) /* {{{ */
{
int sn_hashtable_account (sn_hashtable_t *ht, const sn_network_t *n) /* {{{ */
{
- uint
32
_t hash;
- uint
8
_t h0;
+ uint
64
_t hash;
+ uint
16
_t h0;
uint8_t h1;
uint8_t h2;
uint8_t h3;
uint8_t h1;
uint8_t h2;
uint8_t h3;
@@
-109,15
+109,15
@@
int sn_hashtable_account (sn_hashtable_t *ht, const sn_network_t *n) /* {{{ */
if ((ht == NULL) || (n == NULL))
return (EINVAL);
if ((ht == NULL) || (n == NULL))
return (EINVAL);
- hash =
(uint32_t)
sn_network_get_hashval (n);
+ hash = sn_network_get_hashval (n);
- h0 = (uint
8
_t) (hash >> 24);
- h1 = (uint8_t) (hash >> 16);
- h2 = (uint8_t) (hash >> 8);
- h3 = (uint8_t) hash;
+ h0 = (uint
16
_t) (hash >> 24);
+ h1 = (uint8_t)
(hash >> 16);
+ h2 = (uint8_t)
(hash >> 8);
+ h3 = (uint8_t)
hash;
if (ht->data == NULL)
if (ht->data == NULL)
- ht->data = calloc (
25
6, sizeof (ht->data[0]));
+ ht->data = calloc (
6553
6, sizeof (ht->data[0]));
if (ht->data[h0] == NULL)
ht->data[h0] = calloc (256, sizeof (ht->data[h0][0]));
if (ht->data[h0] == NULL)
ht->data[h0] = calloc (256, sizeof (ht->data[h0][0]));