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