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