-/* Hash of numeric values. */
-static unsigned
-hash_value_numeric (const void *value_, void *foo UNUSED)
-{
- const struct freq *value = value_;
- return hsh_hash_double (value->v.f);
-}
-
-/* Hash of string values. */
-static unsigned
-hash_value_alpha (const void *value_, void *v_)
-{
- const struct freq *value = value_;
- struct variable *v = v_;
-
- return hsh_hash_bytes (value->v.s, v->width);
-}
-
-/* Ascending numeric compare of values. */
-static int
-compare_value_numeric_a (const void *a_, const void *b_, void *foo UNUSED)
-{
- const struct freq *a = a_;
- const struct freq *b = b_;
-
- if (a->v.f > b->v.f)
- return 1;
- else if (a->v.f < b->v.f)
- return -1;
- else
- return 0;
-}
-
-/* Ascending string compare of values. */
-static int
-compare_value_alpha_a (const void *a_, const void *b_, void *v_)
-{
- const struct freq *a = a_;
- const struct freq *b = b_;
- const struct variable *v = v_;
-
- return memcmp (a->v.s, b->v.s, v->width);
-}
-
-/* Descending numeric compare of values. */
-static int
-compare_value_numeric_d (const void *a, const void *b, void *foo UNUSED)
-{
- return -compare_value_numeric_a (a, b, foo);
-}
-
-/* Descending string compare of values. */
-static int
-compare_value_alpha_d (const void *a, const void *b, void *v)
-{
- return -compare_value_alpha_a (a, b, v);
-}
-
-/* Ascending numeric compare of frequency;
- secondary key on ascending numeric value. */
-static int
-compare_freq_numeric_a (const void *a_, const void *b_, void *foo UNUSED)
-{
- const struct freq *a = a_;
- const struct freq *b = b_;
-
- if (a->c > b->c)
- return 1;
- else if (a->c < b->c)
- return -1;
-
- if (a->v.f > b->v.f)
- return 1;
- else if (a->v.f < b->v.f)
- return -1;
- else
- return 0;
-}
-
-/* Ascending numeric compare of frequency;
- secondary key on ascending string value. */
-static int
-compare_freq_alpha_a (const void *a_, const void *b_, void *v_)
-{
- const struct freq *a = a_;
- const struct freq *b = b_;
- const struct variable *v = v_;
-
- if (a->c > b->c)
- return 1;
- else if (a->c < b->c)
- return -1;
- else
- return memcmp (a->v.s, b->v.s, v->width);
-}
-
-/* Descending numeric compare of frequency;
- secondary key on ascending numeric value. */
-static int
-compare_freq_numeric_d (const void *a_, const void *b_, void *foo UNUSED)
-{
- const struct freq *a = a_;
- const struct freq *b = b_;
-
- if (a->c > b->c)
- return -1;
- else if (a->c < b->c)
- return 1;
-
- if (a->v.f > b->v.f)
- return 1;
- else if (a->v.f < b->v.f)
- return -1;
- else
- return 0;
-}
-
-/* Descending numeric compare of frequency;
- secondary key on ascending string value. */
-static int
-compare_freq_alpha_d (const void *a_, const void *b_, void *v_)
-{
- const struct freq *a = a_;
- const struct freq *b = b_;
- const struct variable *v = v_;
-
- if (a->c > b->c)
- return -1;
- else if (a->c < b->c)
- return 1;
- else
- return memcmp (a->v.s, b->v.s, v->width);
-}