py: Fix mpn_sub, was increasing wrong source pointer.

Also change int -> machine_int_t where appropriate.
diff --git a/py/mpz.c b/py/mpz.c
index ab049ba..f4c2b5e 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -113,7 +113,7 @@
         borrow >>= DIG_SIZE;
     }
 
-    for (; jlen > 0; --jlen, ++idig, ++kdig) {
+    for (; jlen > 0; --jlen, ++idig, ++jdig) {
         borrow += *jdig;
         *idig = borrow & DIG_MASK;
         borrow >>= DIG_SIZE;
@@ -315,7 +315,7 @@
 
 #define MIN_ALLOC (4)
 #define ALIGN_ALLOC (2)
-#define NUM_DIG_FOR_INT (sizeof(int) * 8 / DIG_SIZE + 1)
+#define NUM_DIG_FOR_INT (sizeof(machine_int_t) * 8 / DIG_SIZE + 1)
 
 static const uint log_base2_floor[] = {
     0,
@@ -329,7 +329,7 @@
     4, 4, 4, 5
 };
 
-bool mpz_int_is_sml_int(int i) {
+bool mpz_int_is_sml_int(machine_int_t i) {
     return -(1 << DIG_SIZE) < i && i < (1 << DIG_SIZE);
 }
 
@@ -497,7 +497,7 @@
     return cmp;
 }
 
-int mpz_cmp_sml_int(const mpz_t *z, int sml_int) {
+int mpz_cmp_sml_int(const mpz_t *z, machine_int_t sml_int) {
     int cmp;
     if (z->neg == 0) {
         if (sml_int < 0) return 1;
@@ -885,13 +885,13 @@
 }
 #endif
 
-int mpz_as_int(const mpz_t *i) {
-    int val = 0;
+machine_int_t mpz_as_int(const mpz_t *i) {
+    machine_int_t val = 0;
     mpz_dig_t *d = i->dig + i->len;
 
     while (--d >= i->dig)
     {
-        int oldval = val;
+        machine_int_t oldval = val;
         val = (val << DIG_SIZE) | *d;
         if (val < oldval)
         {
diff --git a/py/mpz.h b/py/mpz.h
index eabad62..7449f63 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -11,7 +11,7 @@
     mpz_dig_t *dig;
 } mpz_t;
 
-bool mpz_int_is_sml_int(int i);
+bool mpz_int_is_sml_int(machine_int_t i);
 
 void mpz_init_zero(mpz_t *z);
 void mpz_init_from_int(mpz_t *z, machine_int_t val);
@@ -35,7 +35,7 @@
 bool mpz_is_even(const mpz_t *z);
 
 int mpz_cmp(const mpz_t *lhs, const mpz_t *rhs);
-int mpz_cmp_sml_int(const mpz_t *lhs, int sml_int);
+int mpz_cmp_sml_int(const mpz_t *lhs, machine_int_t sml_int);
 
 mpz_t *mpz_abs(const mpz_t *z);
 mpz_t *mpz_neg(const mpz_t *z);
@@ -58,7 +58,7 @@
 mpz_t *mpz_div(const mpz_t *lhs, const mpz_t *rhs);
 mpz_t *mpz_mod(const mpz_t *lhs, const mpz_t *rhs);
 
-int mpz_as_int(const mpz_t *z);
+machine_int_t mpz_as_int(const mpz_t *z);
 machine_float_t mpz_as_float(const mpz_t *z);
 uint mpz_as_str_size(const mpz_t *z, uint base);
 char *mpz_as_str(const mpz_t *z, uint base);