6f438a
diff --git a/deflate.c b/deflate.c
6f438a
index 1ec7614..b724c8d 100644
6f438a
--- a/deflate.c
6f438a
+++ b/deflate.c
6f438a
@@ -1233,15 +1233,16 @@ local void lm_init (s)
6f438a
 /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
6f438a
  * match.S. The code will be functionally equivalent.
6f438a
  */
6f438a
-local uInt longest_match(s, cur_match)
6f438a
+local uInt longest_match(s, pcur_match)
6f438a
     deflate_state *s;
6f438a
-    IPos cur_match;                             /* current match */
6f438a
+    IPos pcur_match;                             /* current match */
6f438a
 {
6f438a
+    ptrdiff_t cur_match = pcur_match; /* extend to pointer width */
6f438a
     unsigned chain_length = s->max_chain_length;/* max hash chain length */
6f438a
     register Bytef *scan = s->window + s->strstart; /* current string */
6f438a
     register Bytef *match;                      /* matched string */
6f438a
     register int len;                           /* length of current match */
6f438a
-    int best_len = (int)s->prev_length;         /* best match length so far */
6f438a
+    ptrdiff_t best_len = s->prev_length;              /* best match length so far */
6f438a
     int nice_match = s->nice_match;             /* stop if match long enough */
6f438a
     IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
6f438a
         s->strstart - (IPos)MAX_DIST(s) : NIL;
6f438a
@@ -1256,12 +1257,12 @@ local uInt longest_match(s, cur_match)
6f438a
      * Try with and without -DUNALIGNED_OK to check.
6f438a
      */
6f438a
     register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
6f438a
-    register ush scan_start = *(ushf*)scan;
6f438a
-    register ush scan_end   = *(ushf*)(scan+best_len-1);
6f438a
+    register uInt scan_start = *(ushf*)scan;
6f438a
+    register uInt scan_end   = *(ushf*)(scan+best_len-1);
6f438a
 #else
6f438a
     register Bytef *strend = s->window + s->strstart + MAX_MATCH;
6f438a
-    register Byte scan_end1  = scan[best_len-1];
6f438a
-    register Byte scan_end   = scan[best_len];
6f438a
+    register uInt scan_end1  = scan[best_len-1];
6f438a
+    register uInt scan_end   = scan[best_len];
6f438a
 #endif
6f438a
 
6f438a
     /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.