diff --git a/autoconf/intparam.c b/autoconf/intparam.c
index 375ff80..06780db 100644
--- a/autoconf/intparam.c
+++ b/autoconf/intparam.c
@@ -414,8 +414,8 @@ void main5(void) {
 
 void main6(void) {
 #define check_sizeof_pointer(type,typestr)  \
-  { if (!(sizeof(type) <= sizeof(long)))                                 \
-      printf("#error \"Type %s does not fit into a long!!\"\n",typestr); \
+  { if (!(sizeof(type) <= sizeof(ssize_t)))                                 \
+      printf("#error \"Type %s does not fit into a ssize_t!!\"\n",typestr); \
   }
   check_sizeof_pointer(char*,"char *");
   check_sizeof_pointer(long*,"long *");
diff --git a/include/cln/GV.h b/include/cln/GV.h
index 338edfa..00cf2eb 100644
--- a/include/cln/GV.h
+++ b/include/cln/GV.h
@@ -30,14 +30,8 @@ protected:
 public:
 	std::size_t size() const; // number of elements
 	cl_GV_vectorops<T>* vectorops; // get/set element
-	const cl_GV_index<T> operator[] (unsigned long index);
-	const cl_GV_constindex<T> operator[] (unsigned long index) const;
-	const cl_GV_index<T> operator[] (long index);
-	const cl_GV_constindex<T> operator[] (long index) const;
-	const cl_GV_index<T> operator[] (unsigned int index);
-	const cl_GV_constindex<T> operator[] (unsigned int index) const;
-	const cl_GV_index<T> operator[] (int index);
-	const cl_GV_constindex<T> operator[] (int index) const;
+	const cl_GV_index<T> operator[] (std::size_t index);
+	const cl_GV_constindex<T> operator[] (std::size_t index) const;
 public: /* ugh */
 	// Constructor.
 	cl_GV_inner (std::size_t l, cl_GV_vectorops<T>* ops) : len (l), vectorops (ops) {}
@@ -116,54 +110,18 @@ inline std::size_t cl_GV_inner<T>::size() const
 }
 
 template <class T>
-inline const cl_GV_index<T> cl_GV_inner<T>::operator[] (unsigned long index)
+inline const cl_GV_index<T> cl_GV_inner<T>::operator[] (std::size_t index)
 {
 	return cl_GV_index<T>(this,index);
 }
 
 template <class T>
-inline const cl_GV_constindex<T> cl_GV_inner<T>::operator[] (unsigned long index) const
+inline const cl_GV_constindex<T> cl_GV_inner<T>::operator[] (std::size_t index) const
 {
 	return cl_GV_constindex<T>(this,index);
 }
 
 template <class T>
-inline const cl_GV_index<T> cl_GV_inner<T>::operator[] (long index)
-{
-	return operator[]((unsigned long)index);
-}
-
-template <class T>
-inline const cl_GV_constindex<T> cl_GV_inner<T>::operator[] (long index) const
-{
-	return operator[]((unsigned long)index);
-}
-
-template <class T>
-inline const cl_GV_index<T> cl_GV_inner<T>::operator[] (unsigned int index)
-{
-	return operator[]((unsigned long)index);
-}
-
-template <class T>
-inline const cl_GV_constindex<T> cl_GV_inner<T>::operator[] (unsigned int index) const
-{
-	return operator[]((unsigned long)index);
-}
-
-template <class T>
-inline const cl_GV_index<T> cl_GV_inner<T>::operator[] (int index)
-{
-	return operator[]((unsigned long)index);
-}
-
-template <class T>
-inline const cl_GV_constindex<T> cl_GV_inner<T>::operator[] (int index) const
-{
-	return operator[]((unsigned long)index);
-}
-
-template <class T>
 inline cl_GV_inner<T>::~cl_GV_inner ()
 {
 	vectorops->do_delete(this);
@@ -225,26 +183,14 @@ public:
 		return ((const cl_heap_GV<T> *) this->pointer)->v.size();
 	}
 	// Reference. Forbid modification of `const cl_GV&' arguments.
-	const cl_GV_constindex<T> operator[] (unsigned long index) const
+	const cl_GV_constindex<T> operator[] (std::size_t index) const
 	{
 		return ((const cl_heap_GV<T> *) this->pointer)->v[index];
 	}
-	const cl_GV_index<T> operator[] (unsigned long index)
+	const cl_GV_index<T> operator[] (std::size_t index)
 	{
 		return ((cl_heap_GV<T> *) this->pointer)->v[index];
 	}
-	const cl_GV_constindex<T> operator[] (long index) const
-	{ return operator[]((unsigned long)index); }
-	const cl_GV_index<T> operator[] (long index)
-	{ return operator[]((unsigned long)index); }
-	const cl_GV_constindex<T> operator[] (unsigned int index) const
-	{ return operator[]((unsigned long)index); }
-	const cl_GV_index<T> operator[] (unsigned int index)
-	{ return operator[]((unsigned long)index); }
-	const cl_GV_constindex<T> operator[] (int index) const
-	{ return operator[]((unsigned long)index); }
-	const cl_GV_index<T> operator[] (int index)
-	{ return operator[]((unsigned long)index); }
 	// Copy constructor.
 	cl_GV (const cl_GV&);
 	// Assignment operator.
diff --git a/include/cln/SV.h b/include/cln/SV.h
index 7c57614..8bbb5da 100644
--- a/include/cln/SV.h
+++ b/include/cln/SV.h
@@ -48,33 +48,20 @@ private:
 	const T * data() const { return (const T *) (this+1); }
 public:
 	std::size_t size() const { return len; } // number of elements
-	const T & operator[] (unsigned long index) const
+	const T & operator[] (size_t index) const
 	{
 		#ifndef CL_SV_NO_RANGECHECKS
 		if (!(index < size())) throw runtime_exception();
 		#endif
 		return data()[index];
 	}
-	T & operator[] (unsigned long index)
+	T & operator[] (size_t index)
 	{
 		#ifndef CL_SV_NO_RANGECHECKS
 		if (!(index < size())) throw runtime_exception();
 		#endif
 		return data()[index];
 	}
-	// New ANSI C++ compilers also want the following.
-	const T & operator[] (unsigned int index) const
-	{ return operator[]((unsigned long)index); }
-	T & operator[] (unsigned int index)
-	{ return operator[]((unsigned long)index); }
-	const T & operator[] (long index) const
-	{ return operator[]((unsigned long)index); }
-	T & operator[] (long index)
-	{ return operator[]((unsigned long)index); }
-	const T & operator[] (int index) const
-	{ return operator[]((unsigned long)index); }
-	T & operator[] (int index)
-	{ return operator[]((unsigned long)index); }
 public: /* ugh */
 	// Constructor.
 	cl_SV_inner (std::size_t l) : len (l) {}
@@ -121,27 +108,14 @@ public:
 		return ((const cl_heap_SV<T> *) this->pointer)->v.size();
 	}
 	// Reference. Forbid modification of `const cl_SV&' arguments.
-	const T & operator[] (unsigned long index) const
+	const T & operator[] (size_t index) const
 	{
 		return ((const cl_heap_SV<T> *) this->pointer)->v[index];
 	}
-	T & operator[] (unsigned long index)
+	T & operator[] (size_t index)
 	{
 		return ((cl_heap_SV<T> *) this->pointer)->v[index];
 	}
-	// New ANSI C++ compilers also want the following.
-	const T & operator[] (unsigned int index) const
-	{ return operator[]((unsigned long)index); }
-	T & operator[] (unsigned int index)
-	{ return operator[]((unsigned long)index); }
-	const T & operator[] (long index) const
-	{ return operator[]((unsigned long)index); }
-	T & operator[] (long index)
-	{ return operator[]((unsigned long)index); }
-	const T & operator[] (int index) const
-	{ return operator[]((unsigned long)index); }
-	T & operator[] (int index)
-	{ return operator[]((unsigned long)index); }
 	// Constructors.
 	cl_SV (const cl_SV&);
 	// Assignment operators.
diff --git a/include/cln/io.h b/include/cln/io.h
index 361c927..6e3282b 100644
--- a/include/cln/io.h
+++ b/include/cln/io.h
@@ -39,6 +39,10 @@ inline void fprint (std::ostream& stream, const char * string)
 
 extern void fprintdecimal (std::ostream& stream, unsigned long x);
 extern void fprintdecimal (std::ostream& stream, long x);
+#if (long_bitsize != pointer_bitsize)
+extern void fprintdecimal (std::ostream& stream, size_t x);
+extern void fprintdecimal (std::ostream& stream, ssize_t x);
+#endif
 
 inline void fprintdecimal (std::ostream& stream, unsigned int x)
 {
@@ -51,6 +55,10 @@ inline void fprintdecimal (std::ostream& stream, int x)
 
 extern void fprinthexadecimal (std::ostream& stream, unsigned long x);
 extern void fprinthexadecimal (std::ostream& stream, long x);
+#if (int_bitsize != pointer_bitsize)
+extern void fprinthexadecimal (std::ostream& stream, ssize_t x);
+extern void fprinthexadecimal (std::ostream& stream, size_t x);
+#endif
 
 inline void fprinthexadecimal (std::ostream& stream, unsigned int x)
 {
diff --git a/include/cln/number.h b/include/cln/number.h
index b5ac95f..fb0b31e 100644
--- a/include/cln/number.h
+++ b/include/cln/number.h
@@ -233,7 +233,7 @@ inline cl_number::cl_number (cl_private_thing ptr) : cl_gcobject (ptr) {}
 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_number, cl_number)
 // The default constructors.
 inline cl_number::cl_number ()
-	: cl_gcobject ((cl_private_thing) cl_combine(cl_FN_tag,0)) {}
+	: cl_gcobject ((cl_private_thing) cl_combine(cl_FN_tag,(ssize_t)0)) {}
 // The copy constructors.
 CL_DEFINE_COPY_CONSTRUCTOR2(cl_number,cl_gcobject)
 // Constructors and assignment operators from C numeric types.
diff --git a/include/cln/object.h b/include/cln/object.h
index ad0f2f8..ab0ae09 100644
--- a/include/cln/object.h
+++ b/include/cln/object.h
@@ -94,8 +94,8 @@ inline bool cl_immediate_p (cl_uint word)
 #define cl_tag_shift	0
 #define cl_value_shift  (cl_tag_len+cl_tag_shift)
 #define cl_value_len	(cl_pointer_size - cl_value_shift)
-#define cl_tag_mask	(((1UL << cl_tag_len) - 1) << cl_tag_shift)
-#define cl_value_mask	(((1UL << cl_value_len) - 1) << cl_value_shift)
+#define cl_tag_mask	((((size_t)1UL << cl_tag_len) - 1) << cl_tag_shift)
+#define cl_value_mask	((((size_t)1UL << cl_value_len) - 1) << cl_value_shift)
 
 // Return the tag of a word.
 inline cl_uint cl_tag (cl_uint word)
@@ -121,15 +121,27 @@ inline cl_uint cl_combine (cl_uint tag, cl_sint value)
 	return (value << cl_value_shift) + (tag << cl_tag_shift);
 }
 // Keep the compiler happy.
+#if (int_bitsize != pointer_bitsize)
 inline cl_uint cl_combine (cl_uint tag, unsigned int value)
 { return cl_combine(tag, (cl_uint)value); }
 inline cl_uint cl_combine (cl_uint tag, int value)
 { return cl_combine(tag, (cl_sint)value); }
-#ifdef HAVE_LONGLONG
-inline cl_uint cl_combine (cl_uint tag, unsigned long long value)
+#endif
+inline cl_uint cl_combine (cl_uint tag, uint32 value)
 { return cl_combine(tag, (cl_uint)value); }
-inline cl_uint cl_combine (cl_uint tag, long long value)
+inline cl_uint cl_combine (cl_uint tag, sint32 value)
+{ return cl_combine(tag, (cl_sint)value); }
+#if (pointer_bitsize != 64)
+inline cl_uint cl_combine (cl_uint tag, uint64 value)
 { return cl_combine(tag, (cl_uint)value); }
+inline cl_uint cl_combine (cl_uint tag, sint64 value)
+{ return cl_combine(tag, (cl_sint)value); }
+#endif
+#ifdef HAVE_LONGLONG
+//inline cl_uint cl_combine (cl_uint tag, size_t value)
+//{ return cl_combine(tag, (cl_uint)value); }
+//inline cl_uint cl_combine (cl_uint tag, ssize_t value)
+//{ return cl_combine(tag, (cl_uint)value); }
 #endif
 
 // Definition of the tags.
diff --git a/include/cln/symbol.h b/include/cln/symbol.h
index ea59d28..6db4691 100644
--- a/include/cln/symbol.h
+++ b/include/cln/symbol.h
@@ -45,7 +45,7 @@ inline bool equal (const cl_symbol& s1, const cl_symbol& s2)
 }
 
 // Hash code.
-extern unsigned long hashcode (const cl_symbol& s);
+extern size_t hashcode (const cl_symbol& s);
 
 }  // namespace cln
 
diff --git a/include/cln/types.h b/include/cln/types.h
index ce8d7a6..93bb78f 100644
--- a/include/cln/types.h
+++ b/include/cln/types.h
@@ -3,6 +3,8 @@
 #ifndef _CL_TYPES_H
 #define _CL_TYPES_H
 
+#include <cstring>
+
 // CPU and other
 #include "cln/config.h"
 
@@ -100,9 +102,9 @@
 
 // Integer type as large as a pointer.
 // Assumption: sizeof(long) == sizeof(void*)
-  #define intPsize long_bitsize
-  typedef long           sintP;
-  typedef unsigned long  uintP;
+  #define intPsize size_t_bitsize
+  typedef ssize_t sintP;
+  typedef size_t uintP;
 
 // Integer type used for the value of a fixnum.
   #define intVsize long_bitsize
diff --git a/m4/intparam.m4 b/m4/intparam.m4
index b9967bb..28c81a0 100644
--- a/m4/intparam.m4
+++ b/m4/intparam.m4
@@ -24,6 +24,7 @@ AC_DEFUN([CL_INTPARAM_CROSS],
     CL_INTPARAM_BITSIZE([unsigned short], [ushort_bitsize])
     CL_INTPARAM_BITSIZE([unsigned int], [uint_bitsize])
     CL_INTPARAM_BITSIZE([unsigned long], [ulong_bitsize])
+    CL_INTPARAM_BITSIZE([size_t], [size_t_bitsize])
     if test $cl_cv_c_longlong = yes; then
       CL_INTPARAM_BITSIZE([unsigned long long], [ulonglong_bitsize])
     fi
@@ -48,6 +49,13 @@ AC_DEFUN([CL_INTPARAM_CROSS],
     else
       echo "#error \"Integers of type int have no binary representation!!\""
     fi
+    if test -n "$size_t_bitsize"; then
+      echo "/* Integers of type size_t have $size_t_bitsize bits. */"
+      echo "#define size_t_bitsize $size_t_bitsize"
+      echo
+    else
+      echo "#error \"Integers of type size_t have no binary representation!!\""
+    fi
     if test -n "$long_bitsize"; then
       echo "/* Integers of type long have $long_bitsize bits. */"
       echo "#define long_bitsize $long_bitsize"
@@ -113,8 +121,8 @@ AC_DEFUN([CL_INTPARAM_CROSS],
         echo "#error \"Integer types long long and unsigned long long have different sizes!!\""
       fi
     fi
-    AC_TRY_COMPILE([], [typedef int verify[2*(sizeof(char*)<=sizeof (long))-1];],
-      [], [echo "#error \"Type char * does not fit into a long!!\""])
+    AC_TRY_COMPILE([#include <stddef.h>], [typedef int verify[2*(sizeof(char*)<=sizeof (ssize_t))-1];],
+      [], [echo "#error \"Type char * does not fit into a ssize_t!!\""])
     _AC_COMPUTE_INT([sizeof (char *)], [pointer_size])
     pointer_bitsize=`expr $pointer_size '*' $char_bitsize`
     echo "/* Pointers of type char * have $pointer_bitsize bits. */"
@@ -258,7 +266,7 @@ AC_DEFUN([CL_INTPARAM_BITSIZE],
 [
   n=1; x="($1)2"
   while true; do
-    AC_TRY_COMPILE([], [typedef int verify[2*(($1)($x) == 0) - 1];],
+    AC_TRY_COMPILE([#include <stddef.h>], [typedef int verify[2*(($1)($x) == 0) - 1];],
       [$2=$n; break;],
       [if test $n = 1000; then $2=; break; fi;])
     n=`expr $n + 1`; x="$x * ($1)2"
diff --git a/src/base/cl_as_exception.cc b/src/base/cl_as_exception.cc
index 42713c2..66b46cf 100644
--- a/src/base/cl_as_exception.cc
+++ b/src/base/cl_as_exception.cc
@@ -30,7 +30,7 @@ as_error_msg (const cl_number& obj, const char * typestring, const char * filena
 	fprint(buf, obj);
 #else
 	fprint(buf, "@0x");
-	fprinthexadecimal(buf, (unsigned long)(void*)&obj);
+	fprinthexadecimal(buf, (size_t)(void*)&obj);
 	fprint(buf, ": 0x");
 	fprinthexadecimal(buf, (unsigned long)obj.word);
 #endif
diff --git a/src/base/cl_debug.cc b/src/base/cl_debug.cc
index 6c034cd..162a2f1 100644
--- a/src/base/cl_debug.cc
+++ b/src/base/cl_debug.cc
@@ -17,18 +17,18 @@ namespace cln {
 void cl_dprint_unknown (cl_heap* pointer)
 {
 	fprint(cl_debugout, "<unknown @0x");
-	fprinthexadecimal(cl_debugout, (unsigned long) pointer);
+	fprinthexadecimal(cl_debugout, (size_t) pointer);
 	fprint(cl_debugout, " refcount=");
 	fprintdecimal(cl_debugout, pointer->refcount);
 	fprint(cl_debugout, " type=");
-	fprinthexadecimal(cl_debugout, (unsigned long) pointer->type);
+	fprinthexadecimal(cl_debugout, (size_t) pointer->type);
 	fprint(cl_debugout, ">");
 }
 
 static void cl_dprint_unknown_immediate (cl_heap* pointer)
 {
 	fprint(cl_debugout, "<unknown @0x");
-	fprinthexadecimal(cl_debugout, (unsigned long) pointer);
+	fprinthexadecimal(cl_debugout, (size_t) pointer);
 	fprint(cl_debugout, ">");
 }
 
diff --git a/src/base/cl_offsetof.h b/src/base/cl_offsetof.h
index 89ddaf2..eb5af48 100644
--- a/src/base/cl_offsetof.h
+++ b/src/base/cl_offsetof.h
@@ -7,9 +7,9 @@
 
 #undef offsetof
 #if defined(__GNUG__)
-  #define offsetof(type,ident)  ((long)&(((type*)1)->ident)-1)
+  #define offsetof(type,ident)  ((ssize_t)&(((type*)1)->ident)-1)
 #else
-  #define offsetof(type,ident)  ((long)&(((type*)0)->ident))
+  #define offsetof(type,ident)  ((ssize_t)&(((type*)0)->ident))
 #endif
 
 #ifndef _CL_OFFSETOF_H
diff --git a/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h b/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h
index 49eb6b3..53e9656 100644
--- a/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h
+++ b/src/base/hash/cl_rcpointer2_hashweak_rcpointer.h
@@ -14,11 +14,11 @@ static inline bool equal (const cl_rcpointer& x, const cl_rcpointer& y)
 { return (x.pointer == y.pointer); }
 
 // Hash code. Luckily objects don't move around in memory.
-inline unsigned long hashcode (const cl_rcpointer& x1, const cl_rcpointer& x2)
+inline size_t hashcode (const cl_rcpointer& x1, const cl_rcpointer& x2)
 {
-	var unsigned long hashcode1 = (unsigned long)x1.pointer;
-	var unsigned long hashcode2 = (unsigned long)x2.pointer;
-	hashcode2 = (hashcode2 << 5) | (hashcode2 >> (long_bitsize-5)); // rotate
+	var size_t hashcode1 = (size_t)x1.pointer;
+	var size_t hashcode2 = (size_t)x2.pointer;
+	hashcode2 = (hashcode2 << 5) | (hashcode2 >> (long_long_bitsize-5)); // rotate
 	return hashcode1 ^ hashcode2;
 }
 
diff --git a/src/base/hash/cl_rcpointer_hashweak_rcpointer.h b/src/base/hash/cl_rcpointer_hashweak_rcpointer.h
index 2026692..6ccc607 100644
--- a/src/base/hash/cl_rcpointer_hashweak_rcpointer.h
+++ b/src/base/hash/cl_rcpointer_hashweak_rcpointer.h
@@ -14,8 +14,8 @@ static inline bool equal (const cl_rcpointer& x, const cl_rcpointer& y)
 { return (x.pointer == y.pointer); }
 
 // Hash code. Luckily objects don't move around in memory.
-inline unsigned long hashcode (const cl_rcpointer& x)
-{ return (unsigned long)x.pointer; }
+inline size_t hashcode (const cl_rcpointer& x)
+{ return (size_t)x.pointer; }
 
 typedef cl_htentry1<cl_rcpointer,cl_rcpointer> cl_htentry_from_rcpointer_to_rcpointer;
 
diff --git a/src/base/output/cl_output_dec.cc b/src/base/output/cl_output_dec.cc
index f39edc7..de0a7bb 100644
--- a/src/base/output/cl_output_dec.cc
+++ b/src/base/output/cl_output_dec.cc
@@ -40,4 +40,32 @@ void fprintdecimal (std::ostream& stream, long x)
 	}
 }
 
+#if (long_bitsize != pointer_bitsize)
+void fprintdecimal (std::ostream& stream, size_t x)
+{
+	#define bufsize 20
+	var char buf[bufsize+1];
+	var char* bufptr = &buf[bufsize];
+	*bufptr = '\0';
+	do {
+		size_t q = x / 10;
+		size_t r = x % 10;
+		*--bufptr = '0'+r;
+		x = q;
+	} while (x > 0);
+	fprint(stream,bufptr);
+	#undef bufsize
+}
+
+void fprintdecimal (std::ostream& stream, ssize_t x)
+{
+	if (x >= 0)
+		fprintdecimal(stream,(size_t)x);
+	else {
+		fprintchar(stream,'-');
+		fprintdecimal(stream,(size_t)(-1-x)+1);
+	}
+}
+#endif
+
 }  // namespace cln
diff --git a/src/base/output/cl_output_hex.cc b/src/base/output/cl_output_hex.cc
index ea3888b..a68233d 100644
--- a/src/base/output/cl_output_hex.cc
+++ b/src/base/output/cl_output_hex.cc
@@ -37,4 +37,32 @@ void fprinthexadecimal (std::ostream& stream, long x)
 	}
 }
 
+#if (long_bitsize != pointer_bitsize)
+void fprinthexadecimal (std::ostream& stream, size_t x)
+{
+	#define bufsize 16
+	var char buf[bufsize+1];
+	var char* bufptr = &buf[bufsize];
+	*bufptr = '\0';
+	do {
+		size_t q = x / 16;
+		size_t r = x % 16;
+		*--bufptr = (r<10 ? '0'+r : 'A'-10+r);
+		x = q;
+	} while (x > 0);
+	fprint(stream,bufptr);
+	#undef bufsize
+}
+
+void fprinthexadecimal (std::ostream& stream, ssize_t x)
+{
+	if (x >= 0)
+		fprintdecimal(stream,(size_t)x);
+	else {
+		fprintchar(stream,'-');
+		fprintdecimal(stream,(size_t)(-1-x)+1);
+	}
+}
+#endif
+
 }  // namespace cln
diff --git a/src/base/ring/cl_no_ring.cc b/src/base/ring/cl_no_ring.cc
index d15be0f..41e6625 100644
--- a/src/base/ring/cl_no_ring.cc
+++ b/src/base/ring/cl_no_ring.cc
@@ -23,9 +23,9 @@ uninitialized_error_msg (const _cl_ring_element& obj)
 {
 	std::ostringstream buf;
 	fprint(buf, "Uninitialized ring element @0x");
-	fprinthexadecimal(buf, (unsigned long)(void*)&obj);
+	fprinthexadecimal(buf, (size_t)(void*)&obj);
 	fprint(buf, ": 0x");
-        fprinthexadecimal(buf, (unsigned long)obj.rep.word);
+        fprinthexadecimal(buf, (size_t)obj.rep.word);
 	return buf.str();
 }
 
@@ -34,13 +34,13 @@ uninitialized_error_msg (const _cl_ring_element& obj_x, const _cl_ring_element&
 {
 	std::ostringstream buf;
 	fprint(buf, "Uninitialized ring elements @0x");
-	fprinthexadecimal(buf, (unsigned long)(void*)&obj_x);
+	fprinthexadecimal(buf, (size_t)(void*)&obj_x);
 	fprint(buf, ": 0x");
-        fprinthexadecimal(buf, (unsigned long)obj_x.rep.word);
+        fprinthexadecimal(buf, (size_t)obj_x.rep.word);
 	fprint(buf, ", @0x");
-	fprinthexadecimal(buf, (unsigned long)(void*)&obj_y);
+	fprinthexadecimal(buf, (size_t)(void*)&obj_y);
 	fprint(buf, ": 0x");
-        fprinthexadecimal(buf, (unsigned long)obj_y.rep.word);
+        fprinthexadecimal(buf, (size_t)obj_y.rep.word);
 	return buf.str();
 }
 
diff --git a/src/base/symbol/cl_sy_hashcode.cc b/src/base/symbol/cl_sy_hashcode.cc
index 8dcb79b..606cc64 100644
--- a/src/base/symbol/cl_sy_hashcode.cc
+++ b/src/base/symbol/cl_sy_hashcode.cc
@@ -15,13 +15,13 @@ namespace cln {
 
 #define declare_alignof(where,type)  \
   struct CONCAT(aligndummy,__LINE__) { char slot1; type slot2; }; \
-  const unsigned long where = offsetof(CONCAT(aligndummy,__LINE__), slot2);
+  const size_t where = offsetof(CONCAT(aligndummy,__LINE__), slot2);
 
-unsigned long hashcode (const cl_symbol& s)
+size_t hashcode (const cl_symbol& s)
 {
 	// Strings don't move in memory, so we can just take the address.
 	declare_alignof(string_alignment,cl_heap_string);
-	return (unsigned long)(s.pointer)
+	return (size_t)(s.pointer)
 	       / (string_alignment & -string_alignment); // divide by power of 2
 }
 
diff --git a/src/integer/conv/cl_I_from_L.cc b/src/integer/conv/cl_I_from_L.cc
index efc6887..6aaf3c1 100644
--- a/src/integer/conv/cl_I_from_L.cc
+++ b/src/integer/conv/cl_I_from_L.cc
@@ -11,7 +11,7 @@
 
 #include "cln/number.h"
 
-#if (cl_value_len < 32)
+#if (cl_value_len < 32) || defined(_WIN64) || defined(_WIN32)
 
 #include "base/digitseq/cl_DS.h"
 
diff --git a/src/integer/conv/cl_I_from_UL.cc b/src/integer/conv/cl_I_from_UL.cc
index 1671570..df24ecb 100644
--- a/src/integer/conv/cl_I_from_UL.cc
+++ b/src/integer/conv/cl_I_from_UL.cc
@@ -11,7 +11,7 @@
 
 #include "cln/number.h"
 
-#if (cl_value_len <= 32)
+#if (cl_value_len <= 32) || defined(_WIN64) || defined(_WIN32)
 
 #include "base/digitseq/cl_DS.h"
 
