Index: tickcount-0.1/tickcount.c
===================================================================
--- tickcount-0.1.orig/tickcount.c	2010-08-28 13:38:32.000000000 +0200
+++ tickcount-0.1/tickcount.c	2010-08-28 13:38:55.000000000 +0200
@@ -57,7 +57,7 @@
     /* adjust for wrap around */
     diff = new - old;
     if (diff < 0)
-        diff += UINT_MAX;
+        diff += ULONG_MAX;
     return PyInt_FromLong(diff);
 }
 
Index: tickcount-0.1/test_tickcount.py
===================================================================
--- tickcount-0.1.orig/test_tickcount.py	2010-08-28 13:39:16.000000000 +0200
+++ tickcount-0.1/test_tickcount.py	2010-08-28 13:40:21.000000000 +0200
@@ -31,17 +31,17 @@
     def test_difference_wrap(self):
         import struct
 
-        # Work out what the maximum sized unsigned C int is.  Note that
+        # Work out what the maximum sized unsigned C long is.  Note that
         # this will differ from the maximum sized Python int on 64-bit
         # platforms.
-        sizeof_int = struct.calcsize('I')
-        uint_max = struct.unpack('I', '\xff' * sizeof_int)[0]
+        sizeof_long = struct.calcsize('L')
+        ulong_max = struct.unpack('L', '\xff' * sizeof_long)[0]
 
         # create two tick counts that straddle the wrap point
-        oldcount = uint_max / 2 - 10
-        newcount = oldcount + 20 - uint_max
+        oldcount = ulong_max / 2 - 10
+        newcount = oldcount + 20 - ulong_max
 
-        self.assertEqual(tickcount.difference(oldcount, newcount), 20)
+        self.assertEqual(tickcount.difference(oldcount, newcount), 21)
 
 def test_suite():
     loader = unittest.TestLoader()
