diff --git a/src/modules/gmpmod/mpz_glue.c b/src/modules/gmpmod/mpz_glue.c
index d15900eb820f3271e6a225aae70c76b28a34b55a..7aed5ff099e028aa3b4844df5d118358f921dd9f 100644
--- a/src/modules/gmpmod/mpz_glue.c
+++ b/src/modules/gmpmod/mpz_glue.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: mpz_glue.c,v 1.11 1996/11/23 00:08:56 hubbe Exp $");
+RCSID("$Id: mpz_glue.c,v 1.12 1996/11/29 19:02:07 nisse Exp $");
 #include "gmp_machine.h"
 #include "types.h"
 
@@ -159,7 +159,7 @@ static struct pike_string *low_get_digits(MP_INT *mpz, int base)
   }
   else if (base == 256)
   {
-    INT8 i;
+    INT32 i;
     mpz_t tmp;
     
     if (mpz_sgn(mpz) < 0)
@@ -167,7 +167,8 @@ static struct pike_string *low_get_digits(MP_INT *mpz, int base)
     len = (mpz_sizeinbase(mpz, 2) + 7) / 8;
     s = begin_shared_string(len);
     mpz_init_set(tmp, mpz);
-    for (i = len - 1; i>= 0; i-- )
+    i = len;
+    while(i--)
     {
       s->str[i] = mpz_get_ui(tmp) & 0xff;
       mpz_tdiv_q_2exp(tmp, tmp, 8);