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:
41a304f
)
sn_network_get_hashval(): Return a 64bit integer value.
author
Florian Forster
<octo@leeloo.octo.it>
Thu, 13 Jan 2011 13:27:45 +0000
(14:27 +0100)
committer
Florian Forster
<octo@leeloo.octo.it>
Thu, 13 Jan 2011 13:27:45 +0000
(14:27 +0100)
src/sn-info.c
patch
|
blob
|
history
src/sn_comparator.c
patch
|
blob
|
history
src/sn_comparator.h
patch
|
blob
|
history
src/sn_hashtable.c
patch
|
blob
|
history
src/sn_network.c
patch
|
blob
|
history
src/sn_network.h
patch
|
blob
|
history
src/sn_stage.c
patch
|
blob
|
history
src/sn_stage.h
patch
|
blob
|
history
diff --git
a/src/sn-info.c
b/src/sn-info.c
index
e2bc9c9
..
c89d297
100644
(file)
--- a/
src/sn-info.c
+++ b/
src/sn-info.c
@@
-112,7
+112,7
@@
int main (int argc, char **argv)
" Normalized: %4s\n"
" Sorts: %7s\n"
" Rating: %4i\n"
" Normalized: %4s\n"
" Sorts: %7s\n"
" Rating: %4i\n"
- " Hash:
0x%08"PRIx32
"\n"
+ " Hash:
0x%"PRIx64
"\n"
"\n",
comparators_num,
(normalized ? "yes" : "no"),
"\n",
comparators_num,
(normalized ? "yes" : "no"),
diff --git
a/src/sn_comparator.c
b/src/sn_comparator.c
index
0726504
..
1c9a3e6
100644
(file)
--- a/
src/sn_comparator.c
+++ b/
src/sn_comparator.c
@@
-109,14
+109,14
@@
int sn_comparator_compare (const sn_comparator_t *c0,
return (0);
} /* int sn_comparator_compare */
return (0);
} /* int sn_comparator_compare */
-uint
32
_t sn_comparator_get_hashval (const sn_comparator_t *c) /* {{{ */
+uint
64
_t sn_comparator_get_hashval (const sn_comparator_t *c) /* {{{ */
{
if (c == NULL)
return (0);
/* 100937 and 103319 are some random prime numbers */
{
if (c == NULL)
return (0);
/* 100937 and 103319 are some random prime numbers */
- return ((((uint
32
_t) c->min) * 100937)
- + (((uint
32
_t) c->max) * 103319));
+ return ((((uint
64
_t) c->min) * 100937)
+ + (((uint
64
_t) c->max) * 103319));
} /* }}} uint32_t sn_comparator_get_hashval */
/* vim: set shiftwidth=2 softtabstop=2 : */
} /* }}} uint32_t sn_comparator_get_hashval */
/* vim: set shiftwidth=2 softtabstop=2 : */
diff --git
a/src/sn_comparator.h
b/src/sn_comparator.h
index
db9bc07
..
780cd8f
100644
(file)
--- a/
src/sn_comparator.h
+++ b/
src/sn_comparator.h
@@
-117,7
+117,7
@@
void sn_comparator_swap (sn_comparator_t *c, int con0, int con1);
int sn_comparator_compare (const sn_comparator_t *c0,
const sn_comparator_t *c1);
int sn_comparator_compare (const sn_comparator_t *c0,
const sn_comparator_t *c1);
-uint
32
_t sn_comparator_get_hashval (const sn_comparator_t *c);
+uint
64
_t sn_comparator_get_hashval (const sn_comparator_t *c);
#endif /* SN_COMPARATOR_H */
#endif /* SN_COMPARATOR_H */
diff --git
a/src/sn_hashtable.c
b/src/sn_hashtable.c
index
0656644
..
4efb76e
100644
(file)
--- a/
src/sn_hashtable.c
+++ b/
src/sn_hashtable.c
@@
-109,7
+109,7
@@
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 = sn_network_get_hashval (n);
+ hash =
(uint32_t)
sn_network_get_hashval (n);
h0 = (uint8_t) (hash >> 24);
h1 = (uint8_t) (hash >> 16);
h0 = (uint8_t) (hash >> 24);
h1 = (uint8_t) (hash >> 16);
diff --git
a/src/sn_network.c
b/src/sn_network.c
index
c421995
..
9dd2329
100644
(file)
--- a/
src/sn_network.c
+++ b/
src/sn_network.c
@@
-1187,20
+1187,20
@@
sn_network_t *sn_network_unserialize (char *buffer, /* {{{ */
return (n);
} /* }}} sn_network_t *sn_network_unserialize */
return (n);
} /* }}} sn_network_t *sn_network_unserialize */
-uint
32
_t sn_network_get_hashval (const sn_network_t *n) /* {{{ */
+uint
64
_t sn_network_get_hashval (const sn_network_t *n) /* {{{ */
{
{
- uint
32
_t hash;
+ uint
64
_t hash;
int i;
if (n == NULL)
return (0);
int i;
if (n == NULL)
return (0);
- hash = (uint
32
_t) n->inputs_num;
+ hash = (uint
64
_t) n->inputs_num;
for (i = 0; i < n->stages_num; i++)
hash = (hash * 104207) + sn_stage_get_hashval (n->stages[i]);
return (hash);
for (i = 0; i < n->stages_num; i++)
hash = (hash * 104207) + sn_stage_get_hashval (n->stages[i]);
return (hash);
-} /* }}} uint
32
_t sn_network_get_hashval */
+} /* }}} uint
64
_t sn_network_get_hashval */
/* vim: set sw=2 sts=2 et fdm=marker : */
/* vim: set sw=2 sts=2 et fdm=marker : */
diff --git
a/src/sn_network.h
b/src/sn_network.h
index
f29c9b3
..
2e92898
100644
(file)
--- a/
src/sn_network.h
+++ b/
src/sn_network.h
@@
-356,7
+356,7
@@
int sn_network_serialize (sn_network_t *n, char **ret_buffer,
*/
sn_network_t *sn_network_unserialize (char *buffer, size_t buffer_size);
*/
sn_network_t *sn_network_unserialize (char *buffer, size_t buffer_size);
-uint
32
_t sn_network_get_hashval (const sn_network_t *n);
+uint
64
_t sn_network_get_hashval (const sn_network_t *n);
#endif /* SN_NETWORK_H */
#endif /* SN_NETWORK_H */
diff --git
a/src/sn_stage.c
b/src/sn_stage.c
index
dc00b44
..
1a7b2f9
100644
(file)
--- a/
src/sn_stage.c
+++ b/
src/sn_stage.c
@@
-626,20
+626,20
@@
sn_stage_t *sn_stage_unserialize (char **ret_buffer, size_t *ret_buffer_size)
return (s);
} /* sn_stage_t *sn_stage_unserialize */
return (s);
} /* sn_stage_t *sn_stage_unserialize */
-uint
32
_t sn_stage_get_hashval (const sn_stage_t *s) /* {{{ */
+uint
64
_t sn_stage_get_hashval (const sn_stage_t *s) /* {{{ */
{
{
- uint
32
_t hash;
+ uint
64
_t hash;
int i;
if (s == NULL)
return (0);
int i;
if (s == NULL)
return (0);
- hash = (uint
32
_t) s->depth;
+ hash = (uint
64
_t) s->depth;
for (i = 0; i < s->comparators_num; i++)
hash = (hash * 99991) + sn_comparator_get_hashval (s->comparators + i);
return (hash);
for (i = 0; i < s->comparators_num; i++)
hash = (hash * 99991) + sn_comparator_get_hashval (s->comparators + i);
return (hash);
-} /* }}} uint
32
_t sn_stage_get_hashval */
+} /* }}} uint
64
_t sn_stage_get_hashval */
/* vim: set shiftwidth=2 softtabstop=2 expandtab fdm=marker : */
/* vim: set shiftwidth=2 softtabstop=2 expandtab fdm=marker : */
diff --git
a/src/sn_stage.h
b/src/sn_stage.h
index
8cd77cf
..
cdba998
100644
(file)
--- a/
src/sn_stage.h
+++ b/
src/sn_stage.h
@@
-254,7
+254,7
@@
int sn_stage_serialize (sn_stage_t *s,
*/
sn_stage_t *sn_stage_unserialize (char **buffer, size_t *buffer_size);
*/
sn_stage_t *sn_stage_unserialize (char **buffer, size_t *buffer_size);
-uint
32
_t sn_stage_get_hashval (const sn_stage_t *s);
+uint
64
_t sn_stage_get_hashval (const sn_stage_t *s);
#endif /* SN_STAGE_H */
#endif /* SN_STAGE_H */