X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fsn_stage.c;h=1b564cc6796a909820150ade6c62663291bbe4fa;hb=518eb323bcc57e22984f75134a6c6b44876d8dd2;hp=d0d54d79425bcb76e134fe1d2c8293b8848c937e;hpb=da9a9395aeedf0d77306994d6e9fbea6f40cd9b0;p=sort-networks.git diff --git a/src/sn_stage.c b/src/sn_stage.c index d0d54d7..1b564cc 100644 --- a/src/sn_stage.c +++ b/src/sn_stage.c @@ -608,4 +608,20 @@ sn_stage_t *sn_stage_unserialize (char **ret_buffer, size_t *ret_buffer_size) return (s); } /* sn_stage_t *sn_stage_unserialize */ -/* vim: set shiftwidth=2 softtabstop=2 expandtab : */ +uint32_t sn_stage_get_hashval (const sn_stage_t *s) /* {{{ */ +{ + uint32_t hash; + int i; + + if (s == NULL) + return (0); + + hash = (uint32_t) s->depth; + + for (i = 0; i < s->comparators_num; i++) + hash = (hash * 99991) + sn_comparator_get_hashval (s->comparators + i); + + return (hash); +} /* }}} uint32_t sn_stage_get_hashval */ + +/* vim: set shiftwidth=2 softtabstop=2 expandtab fdm=marker : */