+/*
+ * enum_val_equal assumes that signed and unsigned memory layout overlap.
+ */
+struct enum_range {
+ union {
+ int64_t _signed;
+ uint64_t _unsigned;
+ } start; /* lowest range value */
+ union {
+ int64_t _signed;
+ uint64_t _unsigned;
+ } end; /* highest range value */
+};
+
+struct enum_range_to_quark {
+ struct cds_list_head node;
+ struct enum_range range;
+ GQuark quark;
+};
+
+/*
+ * We optimize the common case (range of size 1: single value) by creating a
+ * hash table mapping values to quark sets. We then lookup the ranges to
+ * complete the quark set.
+ *
+ * TODO: The proper structure to hold the range to quark set mapping would be an
+ * interval tree, with O(n) size, O(n*log(n)) build time and O(log(n)) query
+ * time. Using a simple O(n) list search for now for implementation speed and
+ * given that we can expect to have a _relatively_ small number of enumeration
+ * ranges. This might become untrue if we are fed with symbol tables often
+ * required to lookup function names from instruction pointer value.
+ */