diff --git a/contrib/pgcrypto/imath.c b/contrib/pgcrypto/imath.c
index 4fef2184211cdc3e7b05f1ba50f14e66955aa9d6..1b66279b8f43fc4282e886d6ab55fb1a46bba776 100644
--- a/contrib/pgcrypto/imath.c
+++ b/contrib/pgcrypto/imath.c
@@ -3,7 +3,7 @@
   Name:     imath.c
   Purpose:  Arbitrary precision integer arithmetic routines.
   Author:   M. J. Fromberger <http://www.dartmouth.edu/~sting/>
-  Info:     $Id: imath.c,v 1.1 2006/07/13 04:15:24 neilc Exp $
+  Info:     $Id: imath.c,v 1.2 2006/07/15 15:27:14 tgl Exp $
 
   Copyright (C) 2002 Michael J. Fromberger, All Rights Reserved.
 
@@ -33,7 +33,7 @@
 #include "imath.h"
 
 #undef assert
-#define assert(TEST)
+#define assert(TEST) Assert(TEST)
 #define TRACEABLE_CLAMP 0
 #define TRACEABLE_FREE 0
 
diff --git a/contrib/pgcrypto/imath.h b/contrib/pgcrypto/imath.h
index 150c9e4047f2295514b12799785adab3ef1c6c9e..c2ec7fcb7368b5dbfdf9ca5392f48fc0b8c2332d 100644
--- a/contrib/pgcrypto/imath.h
+++ b/contrib/pgcrypto/imath.h
@@ -2,7 +2,7 @@
   Name:     imath.h
   Purpose:  Arbitrary precision integer arithmetic routines.
   Author:   M. J. Fromberger <http://www.dartmouth.edu/~sting/>
-  Info:     $Id: imath.h,v 1.1 2006/07/13 04:15:24 neilc Exp $
+  Info:     $Id: imath.h,v 1.2 2006/07/15 15:27:14 tgl Exp $
 
   Copyright (C) 2002 Michael J. Fromberger, All Rights Reserved.
 
@@ -39,11 +39,15 @@ typedef unsigned char      mp_sign;
 typedef unsigned int       mp_size;
 typedef int                mp_result;
 #ifdef USE_LONG_LONG
-typedef unsigned int       mp_digit;
-typedef unsigned long long mp_word;
+typedef uint32             mp_digit;
+typedef uint64             mp_word;
+#define MP_DIGIT_MAX       0xFFFFFFFFULL
+#define MP_WORD_MAX        0xFFFFFFFFFFFFFFFFULL
 #else
-typedef unsigned short     mp_digit;
-typedef unsigned int       mp_word;
+typedef uint16             mp_digit;
+typedef uint32             mp_word;
+#define MP_DIGIT_MAX       0xFFFFUL
+#define MP_WORD_MAX        0xFFFFFFFFUL
 #endif
 
 typedef struct mpz {
@@ -70,21 +74,6 @@ extern const mp_result MP_BADARG;
 #define MP_DIGIT_BIT    (sizeof(mp_digit) * CHAR_BIT)
 #define MP_WORD_BIT     (sizeof(mp_word) * CHAR_BIT)
 
-#ifdef USE_LONG_LONG
-#  ifndef ULONG_LONG_MAX
-#    ifdef ULLONG_MAX
-#      define ULONG_LONG_MAX   ULLONG_MAX
-#    else
-#      error "Maximum value of unsigned long long not defined!"
-#    endif
-#  endif
-#  define MP_DIGIT_MAX   (ULONG_MAX * 1ULL)
-#  define MP_WORD_MAX    ULONG_LONG_MAX
-#else
-#  define MP_DIGIT_MAX    (USHRT_MAX * 1UL)
-#  define MP_WORD_MAX     (UINT_MAX * 1UL)
-#endif
-
 #define MP_MIN_RADIX    2
 #define MP_MAX_RADIX    36