+/* Line info hash table */
+static HashTable LineInfoTab = STATIC_HASHTABLE_INITIALIZER (1051, &HashFunc);
+
+/* The current assembler input line */
+static LineInfo* AsmLineInfo = 0;
+
+
+
+/*****************************************************************************/
+/* Hash table functions */
+/*****************************************************************************/
+
+
+
+static unsigned HT_GenHash (const void* Key)
+/* Generate the hash over a key. */
+{
+ /* Key is a LineInfoKey pointer */
+ const LineInfoKey* K = Key;
+
+ /* Hash over a combination of type, file and line */
+ return HashInt ((K->Type << 18) ^ (K->Pos.Name << 14) ^ K->Pos.Line);
+}
+
+
+
+static const void* HT_GetKey (const void* Entry)
+/* Given a pointer to the user entry data, return a pointer to the key */
+{
+ return &((const LineInfo*)Entry)->Key;
+}
+
+
+
+static int HT_Compare (const void* Key1, const void* Key2)
+/* Compare two keys. The function must return a value less than zero if
+ * Key1 is smaller than Key2, zero if both are equal, and a value greater
+ * than zero if Key1 is greater then Key2.
+ */
+{
+ /* Convert both parameters to FileInfoKey pointers */
+ const LineInfoKey* K1 = Key1;
+ const LineInfoKey* K2 = Key2;
+
+ /* Compare line number, then file and type, then count */
+ int Res = (int)K2->Pos.Line - (int)K1->Pos.Line;
+ if (Res == 0) {
+ Res = (int)K2->Pos.Name - (int)K1->Pos.Name;
+ if (Res == 0) {
+ Res = (int)K2->Type - (int)K1->Type;
+ if (Res == 0) {
+ Res = (int)K2->Count - (int)K1->Count;
+ }
+ }
+ }
+
+ /* Done */
+ return Res;
+}