Index: main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/perf_hash.c
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/perf_hash.c	(revision 24007)
+++ main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/perf_hash.c	(revision 24031)
@@ -42,5 +42,5 @@
 
 /* Random Number stuff */
-static long seed[] = {0, 0};
+static mg_s_long seed[] = {0, 0};
 #define RANDOM() irandm(seed)
 #define SEED_RANDOM(the_seed) do{ seed[0] = the_seed; }while(0)
@@ -105,5 +105,5 @@
 
 #ifndef STRUCT
-static long **tb0, **tb1, **tb2;
+static mg_s_long **tb0, **tb1, **tb2;
 #else
 struct tb_entry **tb;
@@ -128,6 +128,5 @@
 {				/* deletes edge e from list of v */
 
-  int b;
-
+  int b, norm_b;
   b = FIRST[v];
   assert (norm (b) != 0);
@@ -700,11 +699,11 @@
     {
       if (tb0)
-	if (!(tb0[i] = Xmalloc (sizeof (long) * MAX_L)))
+	if (!(tb0[i] = Xmalloc (sizeof (mg_s_long) * MAX_L)))
 	    ok = 0;
       if (tb1)
-	if (!(tb1[i] = Xmalloc (sizeof (long) * MAX_L)))
+	if (!(tb1[i] = Xmalloc (sizeof (mg_s_long) * MAX_L)))
 	    ok = 0;
       if (tb2)
-	if (!(tb2[i] = Xmalloc (sizeof (long) * MAX_L)))
+	if (!(tb2[i] = Xmalloc (sizeof (mg_s_long) * MAX_L)))
 	    ok = 0;
     }
@@ -744,5 +743,5 @@
 
   if (r <= 0)
-    SEED_RANDOM ((long) time ((time_t *) NULL));
+    SEED_RANDOM ((mg_s_long) time ((time_t *) NULL));
   else
     SEED_RANDOM (r);
@@ -907,11 +906,11 @@
     {
       if (phd->tb0)
-	if (!(phd->tb0[i] = Xmalloc (sizeof (long) * phd->MAX_L)))
+	if (!(phd->tb0[i] = Xmalloc (sizeof (mg_s_long) * phd->MAX_L)))
 	    ok = 0;
       if (phd->tb1)
-	if (!(phd->tb1[i] = Xmalloc (sizeof (long) * phd->MAX_L)))
+	if (!(phd->tb1[i] = Xmalloc (sizeof (mg_s_long) * phd->MAX_L)))
 	    ok = 0;
       if (phd->tb2)
-	if (!(phd->tb2[i] = Xmalloc (sizeof (long) * phd->MAX_L)))
+	if (!(phd->tb2[i] = Xmalloc (sizeof (mg_s_long) * phd->MAX_L)))
 	    ok = 0;
     }
@@ -951,9 +950,9 @@
       int j;
 
-      tot += fread ((char *) phd->tb0[i], sizeof (long), phd->MAX_L, f) *
+      tot += fread ((char *) phd->tb0[i], sizeof (mg_s_long), phd->MAX_L, f) *
         sizeof (int);
-      tot += fread ((char *) phd->tb1[i], sizeof (long), phd->MAX_L, f) *
+      tot += fread ((char *) phd->tb1[i], sizeof (mg_s_long), phd->MAX_L, f) *
         sizeof (int);
-      tot += fread ((char *) phd->tb2[i], sizeof (long), phd->MAX_L, f) *
+      tot += fread ((char *) phd->tb2[i], sizeof (mg_s_long), phd->MAX_L, f) *
         sizeof (int);
 
Index: main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/perf_hash.h
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/perf_hash.h	(revision 24007)
+++ main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/perf_hash.h	(revision 24031)
@@ -23,10 +23,9 @@
 #define H_PERF_HASH
 
-
-
+#include "mglong.h"
 
 struct tb_entry
   {
-    long tb0, tb1, tb2;
+    mg_s_long tb0, tb1, tb2;
   };
 
Index: main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/random.c
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/random.c	(revision 24007)
+++ main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/random.c	(revision 24031)
@@ -33,6 +33,7 @@
  *	The table mt[0:127] is defined by mt[i] = 69069 ** (128-i)
  */
-
-#define MASK ((long) 593970775)
+#include "random.h"
+
+#define MASK ((mg_s_long) 593970775)
 /*	or in hex, 23674657	*/
 
@@ -40,5 +41,5 @@
 /*	i.e. 2 to power -31	*/
 
-static long mt [128] =   {
+static mg_s_long mt [128] =   {
       902906369,
      2030498053,
@@ -172,7 +173,7 @@
 
 double 
-random (long is [2])
+random (mg_s_long is [2])
 {
-	long it, leh, nit;
+	mg_s_long it, leh, nit;
 
 	it = is [0];
@@ -187,13 +188,13 @@
 	is [0] = it;    is [1] = leh;
 	if (leh < 0) leh = ~leh;
-	return (SCALE * ((long) (leh | 1)));
+	return (SCALE * ((mg_s_long) (leh | 1)));
 }
 
 
 
-long 
-irandm (long is [2])
+mg_s_long 
+irandm (mg_s_long is [2])
 {
-	long it, leh, nit;
+	mg_s_long it, leh, nit;
 
 	it = is [0];
Index: main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/random.h
===================================================================
--- main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/random.h	(revision 24007)
+++ main/branches/64_bit_Greenstone/greenstone2/common-src/indexers/mg/lib/random.h	(revision 24031)
@@ -36,7 +36,8 @@
  *	The table mt[0:127] is defined by mt[i] = 69069 ** (128-i)
  */
+#include "mglong.h"
 
-double random (long is [2]);
-long irandm (long is [2]);
+double random (mg_s_long is [2]);
+mg_s_long irandm (mg_s_long is [2]);
 
 #endif
