=== d/dmd/dchar.c
==================================================================
--- d/dmd/dchar.c	(revision 20)
+++ d/dmd/dchar.c	(local)
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
+#include <stdint.h>
 
 #include "dchar.h"
 #include "mem.h"
@@ -88,9 +89,9 @@
     }
 }
 #else
-unsigned Dchar::calcHash(const dchar *str, unsigned len)
+hash_t Dchar::calcHash(const dchar *str, size_t len)
 {
-    unsigned hash = 0;
+    hash_t hash = 0;
 
     for (;;)
     {
@@ -100,15 +101,15 @@
 		return hash;
 
 	    case 1:
-		hash += *(unsigned short *)str;
+		hash += *(uint16_t *)str;
 		return hash;
 
 	    case 2:
-		hash += *(unsigned long *)str;
+		hash += *(uint32_t *)str;
 		return hash;
 
 	    default:
-		hash += *(long *)str;
+		hash += *(uint32_t *)str;
 		hash *= 37;
 		str += 2;
 		len -= 2;
@@ -118,9 +119,9 @@
 }
 #endif
 
-unsigned Dchar::icalcHash(const dchar *str, unsigned len)
+hash_t Dchar::icalcHash(const dchar *str, size_t len)
 {
-    unsigned hash = 0;
+    hash_t hash = 0;
 
     for (;;)
     {
@@ -130,15 +131,15 @@
 		return hash;
 
 	    case 1:
-		hash += *(unsigned short *)str | 0x20;
+		hash += *(uint16_t *)str | 0x20;
 		return hash;
 
 	    case 2:
-		hash += *(unsigned long *)str | 0x200020;
+		hash += *(uint32_t *)str | 0x200020;
 		return hash;
 
 	    default:
-		hash += *(unsigned long *)str | 0x200020;
+		hash += *(uint32_t *)str | 0x200020;
 		hash *= 37;
 		str += 2;
 		len -= 2;
@@ -149,9 +150,9 @@
 
 #elif MCBS
 
-unsigned Dchar::calcHash(const dchar *str, unsigned len)
+hash_t Dchar::calcHash(const dchar *str, size_t len)
 {
-    unsigned hash = 0;
+    hash_t hash = 0;
 
     while (1)
     {
@@ -162,23 +163,23 @@
 
 	    case 1:
 		hash *= 37;
-		hash += *(unsigned char *)str;
+		hash += *(uint8_t *)str;
 		return hash;
 
 	    case 2:
 		hash *= 37;
-		hash += *(unsigned short *)str;
+		hash += *(uint16_t *)str;
 		return hash;
 
 	    case 3:
 		hash *= 37;
-		hash += (*(unsigned short *)str << 8) +
-			((unsigned char *)str)[2];
+		hash += (*(uint16_t *)str << 8) +
+			((uint8_t *)str)[2];
 		return hash;
 
 	    default:
 		hash *= 37;
-		hash += *(long *)str;
+		hash += *(int32_t *)str;
 		str += 4;
 		len -= 4;
 		break;
@@ -314,9 +315,9 @@
     return p;
 }
 
-unsigned Dchar::calcHash(const dchar *str, unsigned len)
+hash_t Dchar::calcHash(const dchar *str, size_t len)
 {
-    unsigned hash = 0;
+    hash_t hash = 0;
 
     while (1)
     {
@@ -327,13 +328,13 @@
 
 	    case 1:
 		hash *= 37;
-		hash += *(unsigned char *)str;
+		hash += *(uint8_t *)str;
 		return hash;
 
 	    case 2:
 		hash *= 37;
 #if __I86__
-		hash += *(unsigned short *)str;
+		hash += *(uint16_t *)str;
 #else
 		hash += str[0] * 256 + str[1];
 #endif
@@ -342,8 +343,8 @@
 	    case 3:
 		hash *= 37;
 #if __I86__
-		hash += (*(unsigned short *)str << 8) +
-			((unsigned char *)str)[2];
+		hash += (*(uint16_t *)str << 8) +
+			((uint8_t *)str)[2];
 #else
 		hash += (str[0] * 256 + str[1]) * 256 + str[2];
 #endif
@@ -352,7 +353,7 @@
 	    default:
 		hash *= 37;
 #if __I86__
-		hash += *(long *)str;
+		hash += *(uint32_t *)str;
 #else
 		hash += ((str[0] * 256 + str[1]) * 256 + str[2]) * 256 + str[3];
 #endif
@@ -365,9 +366,9 @@
 
 #else // ascii
 
-unsigned Dchar::calcHash(const dchar *str, unsigned len)
+hash_t Dchar::calcHash(const dchar *str, size_t len)
 {
-    unsigned hash = 0;
+    hash_t hash = 0;
 
     while (1)
     {
@@ -378,7 +379,7 @@
 
 	    case 1:
 		hash *= 37;
-		hash += *(unsigned char *)str;
+		hash += *(uint8_t *)str;
 		return hash;
 
 	    case 2:
@@ -405,9 +406,9 @@
     }
 }
 
-unsigned Dchar::icalcHash(const dchar *str, unsigned len)
+hash_t Dchar::icalcHash(const dchar *str, size_t len)
 {
-    unsigned hash = 0;
+    hash_t hash = 0;
 
     while (1)
     {
@@ -418,23 +419,23 @@
 
 	    case 1:
 		hash *= 37;
-		hash += *(unsigned char *)str | 0x20;
+		hash += *(uint8_t *)str | 0x20;
 		return hash;
 
 	    case 2:
 		hash *= 37;
-		hash += *(unsigned short *)str | 0x2020;
+		hash += *(uint16_t *)str | 0x2020;
 		return hash;
 
 	    case 3:
 		hash *= 37;
-		hash += ((*(unsigned short *)str << 8) +
-			 ((unsigned char *)str)[2]) | 0x202020;
+		hash += ((*(uint16_t *)str << 8) +
+			 ((uint8_t *)str)[2]) | 0x202020;
 		return hash;
 
 	    default:
 		hash *= 37;
-		hash += *(long *)str | 0x20202020;
+		hash += *(int32_t *)str | 0x20202020;
 		str += 4;
 		len -= 4;
 		break;
=== d/dmd/dchar.h
==================================================================
--- d/dmd/dchar.h	(revision 20)
+++ d/dmd/dchar.h	(local)
@@ -20,7 +20,7 @@
     #pragma warning (disable : 4514)
 #endif
 
-//#include "root.h"
+#include "root.h"
 
 #undef TEXT
 
@@ -74,12 +74,12 @@
     static dchar *memchr(dchar *p, int c, int count);
     static dchar *cpy(dchar *s1, dchar *s2) { return wcscpy(s1, s2); }
     static dchar *str(dchar *s1, dchar *s2) { return wcsstr(s1, s2); }
-    static unsigned calcHash(const dchar *str, unsigned len);
+    static hash_t calcHash(const dchar *str, size_t len);
 
     // Case insensitive versions
     static int icmp(dchar *s1, dchar *s2) { return wcsicmp(s1, s2); }
     static int memicmp(const dchar *s1, const dchar *s2, int nchars) { return ::wcsnicmp(s1, s2, nchars); }
-    static unsigned icalcHash(const dchar *str, unsigned len);
+    static hash_t icalcHash(const dchar *str, size_t len);
 };
 
 #elif MCBS
@@ -128,7 +128,7 @@
 	{ return (dchar *)::memchr(p, c, count); }
     static dchar *cpy(dchar *s1, dchar *s2) { return strcpy(s1, s2); }
     static dchar *str(dchar *s1, dchar *s2) { return strstr(s1, s2); }
-    static unsigned calcHash(const dchar *str, unsigned len);
+    static hash_t calcHash(const dchar *str, size_t len);
 
     // Case insensitive versions
     static int icmp(dchar *s1, dchar *s2) { return _mbsicmp(s1, s2); }
@@ -176,7 +176,7 @@
 	{ return (dchar *)::memchr(p, c, count); }
     static dchar *cpy(dchar *s1, dchar *s2) { return strcpy(s1, s2); }
     static dchar *str(dchar *s1, dchar *s2) { return strstr(s1, s2); }
-    static unsigned calcHash(const dchar *str, unsigned len);
+    static hash_t calcHash(const dchar *str, size_t len);
 
     // Case insensitive versions
 #ifdef __GNUC__
@@ -185,7 +185,7 @@
     static int icmp(dchar *s1, dchar *s2) { return stricmp(s1, s2); }
 #endif
     static int memicmp(const dchar *s1, const dchar *s2, int nchars) { return ::memicmp(s1, s2, nchars); }
-    static unsigned icalcHash(const dchar *str, unsigned len);
+    static hash_t icalcHash(const dchar *str, size_t len);
 };
 
 #endif
=== d/dmd/identifier.c
==================================================================
--- d/dmd/identifier.c	(revision 20)
+++ d/dmd/identifier.c	(local)
@@ -29,7 +29,7 @@
     this->len = strlen(string);
 }
 
-unsigned Identifier::hashCode()
+hash_t Identifier::hashCode()
 {
     return String::calcHash(string);
 }
=== d/dmd/identifier.h
==================================================================
--- d/dmd/identifier.h	(revision 20)
+++ d/dmd/identifier.h	(local)
@@ -24,7 +24,7 @@
 
     Identifier(const char *string, int value);
     int equals(Object *o);
-    unsigned hashCode();
+    hash_t hashCode();
     int compare(Object *o);
     void print();
     char *toChars();
=== d/dmd/lstring.h
==================================================================
--- d/dmd/lstring.h	(revision 20)
+++ d/dmd/lstring.h	(local)
@@ -50,8 +50,8 @@
 
     dchar *toDchars() { return string; }
 
-    unsigned hash() { return Dchar::calcHash(string, length); }
-    unsigned ihash() { return Dchar::icalcHash(string, length); }
+    hash_t hash() { return Dchar::calcHash(string, length); }
+    hash_t ihash() { return Dchar::icalcHash(string, length); }
 
     static int cmp(const Lstring *s1, const Lstring *s2)
     {
=== d/dmd/root.c
==================================================================
--- d/dmd/root.c	(revision 20)
+++ d/dmd/root.c	(local)
@@ -18,6 +18,7 @@
 #include <stdarg.h>
 #include <string.h>
 #include <assert.h>
+#include <stdint.h>
 
 #include "gdc_alloca.h"
 
@@ -175,9 +176,9 @@
     return o == this;
 }
 
-unsigned Object::hashCode()
+hash_t Object::hashCode()
 {
-    return (int) this;
+    return (hash_t) this;
 }
 
 int Object::compare(Object *obj)
@@ -236,9 +237,9 @@
     mem.mark(str);
 }
 
-unsigned String::calcHash(const char *str, unsigned len)
+hash_t String::calcHash(const char *str, size_t len)
 {
-    unsigned hash = 0;
+    hash_t hash = 0;
 
     for (;;)
     {
@@ -249,18 +250,18 @@
 
 	    case 1:
 		hash *= 37;
-		hash += *(unsigned char *)str;
+		hash += *(uint8_t *)str;
 		return hash;
 
 	    case 2:
 		hash *= 37;
-		hash += *(unsigned short *)str;
+		hash += *(uint16_t *)str;
 		return hash;
 
 	    case 3:
 		hash *= 37;
-		hash += (*(unsigned short *)str << 8) +
-			((unsigned char *)str)[2];
+		hash += (*(uint16_t *)str << 8) +
+			((uint8_t *)str)[2];
 		return hash;
 
 	    default:
@@ -273,12 +274,12 @@
     }
 }
 
-unsigned String::calcHash(const char *str)
+hash_t String::calcHash(const char *str)
 {
     return calcHash(str, strlen(str));
 }
 
-unsigned String::hashCode()
+hash_t String::hashCode()
 {
     return calcHash(str, strlen(str));
 }
@@ -421,7 +422,7 @@
     return array;
 }
 
-unsigned FileName::hashCode()
+hash_t FileName::hashCode()
 {
 #ifndef _WIN32
     // darwin HFS is case insensitive, though...
=== d/dmd/root.h
==================================================================
--- d/dmd/root.h	(revision 20)
+++ d/dmd/root.h	(local)
@@ -24,6 +24,8 @@
 #pragma once
 #endif
 
+typedef size_t hash_t;
+
 #include "dchar.h"
 
 char *wchar2ascii(wchar_t *);
@@ -71,7 +73,7 @@
     /**
      * Returns a hash code, useful for things like building hash tables of Objects.
      */
-    virtual unsigned hashCode();
+    virtual hash_t hashCode();
 
     /**
      * Return <0, ==0, or >0 if this is less than, equal to, or greater than obj.
@@ -110,9 +112,9 @@
 
     ~String();
 
-    static unsigned calcHash(const char *str, unsigned len);
-    static unsigned calcHash(const char *str);
-    unsigned hashCode();
+    static hash_t calcHash(const char *str, size_t len);
+    static hash_t calcHash(const char *str);
+    hash_t hashCode();
     unsigned len();
     int equals(Object *obj);
     int compare(Object *obj);
@@ -125,7 +127,7 @@
 {
     FileName(char *str, int ref);
     FileName(char *path, char *name);
-    unsigned hashCode();
+    hash_t hashCode();
     int equals(Object *obj);
     int compare(Object *obj);
     static int absolute(const char *name);
=== d/dmd/stringtable.c
==================================================================
--- d/dmd/stringtable.c	(revision 20)
+++ d/dmd/stringtable.c	(local)
@@ -41,7 +41,7 @@
 {
     StringEntry *left;
     StringEntry *right;
-    unsigned hash;
+    hash_t hash;
 
     StringValue value;
 
@@ -61,7 +61,7 @@
 
 void **StringTable::search(const dchar *s, unsigned len)
 {
-    unsigned hash;
+    hash_t hash;
     unsigned u;
     int cmp;
     StringEntry **se;
=== d/dmd/typinf.c
==================================================================
--- d/dmd/typinf.c	(revision 20)
+++ d/dmd/typinf.c	(local)
@@ -349,7 +349,7 @@
     /* Put out:
      *	char[] name;
      *	uint xsize;
-     *	uint function(void*) xtoHash;
+     *	hash_t function(void*) xtoHash;
      *	int function(void*,void*) xopEquals;
      *	int function(void*,void*) xopCmp;
      */
@@ -372,7 +372,7 @@
     if (!tftohash)
     {
 	Scope sc;
-	tftohash = new TypeFunction(NULL, Type::tuns32, 0, LINKd);
+	tftohash = new TypeFunction(NULL, Type::tsize_t, 0, LINKd);
 	tftohash = (TypeFunction *)tftohash->semantic(0, &sc);
     }
 
