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