+
+/* Returns a hash value that represents all of the labels in VLS, starting from
+ BASIS. */
+unsigned int
+val_labs_hash (const struct val_labs *vls, unsigned int basis)
+{
+ const struct val_lab *label;
+ unsigned int hash;
+
+ hash = hash_int (val_labs_count (vls), basis);
+ HMAP_FOR_EACH (label, struct val_lab, node, &vls->labels)
+ hash ^= value_hash (&label->value, vls->width,
+ hash_string (label->label, basis));
+ return hash;
+}
+
+/* Returns true if A and B contain the same values with the same labels,
+ false if they differ in some way. */
+bool
+val_labs_equal (const struct val_labs *a, const struct val_labs *b)
+{
+ const struct val_lab *label;
+
+ if (val_labs_count (a) != val_labs_count (b) || a->width != b->width)
+ return false;
+
+ HMAP_FOR_EACH (label, struct val_lab, node, &a->labels)
+ {
+ struct val_lab *label2 = val_labs_lookup__ (b, &label->value,
+ label->node.hash);
+ if (!label2 || label->label != label2->label)
+ return false;
+ }
+
+ return true;
+}