Commit e94b809 for gzip

commit e94b809fa68609ea1f7774d3f277828f03233221
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Sun Nov 15 07:09:44 2026 -0800

    gzip: more cleanout of old 16-bit code

    * deflate.c (window_size): Now an enum, not a const, to help
    pacify compilers not doing optimization.
    (fill_window): Omit dynamic check no longer needed now that we no
    longer worry about 16-bit int.  Use static check instead.

diff --git a/bits.c b/bits.c
index 8b369e2..7b5fc62 100644
--- a/bits.c
+++ b/bits.c
@@ -38,8 +38,7 @@
  *
  *      For in-memory compression, the compressed bit stream goes directly
  *      into the requested output buffer. The input data is read in blocks
- *      by the mem_read() function. The buffer is limited to 64K on 16 bit
- *      machines.
+ *      by the mem_read() function.
  *
  *  INTERFACE
  *
diff --git a/deflate.c b/deflate.c
index b3c2b67..514fe08 100644
--- a/deflate.c
+++ b/deflate.c
@@ -86,7 +86,7 @@

 #ifndef HASH_BITS
 #   define HASH_BITS  15
-   /* For portability to 16 bit machines, do not use values above 15. */
+   /* For portability to 32 bit machines, do not use values above 31. */
 #endif

 /* To save space (see unlzw.c), we overlay prev+head with tab_prefix and
@@ -148,9 +148,7 @@ typedef unsigned IPos;
 /* extern Pos head[1 << HASH_BITS]; */
 /* Heads of the hash chains or NIL. */

-static ulg const window_size = 2 * WSIZE;
-/* window size, always 2*WSIZE.
- */
+enum { window_size = 2 * WSIZE };

 long block_start;
 /* window position at the beginning of the current output block. Gets
@@ -417,7 +415,7 @@ longest_match(IPos cur_match)
         /* The funny "do {}" generates better code on most compilers */

         /* Here, scan <= window+strstart+257 */
-        Assert(scan <= window+(unsigned)(window_size-1), "wild scan");
+        Assert (scan < window + window_size, "wild scan");
         if (*scan == *match) scan++;

         len = (MAX_MATCH - 1) - (int)(strend-scan);
@@ -513,16 +511,8 @@ fill_window ()
     /* If the window is almost full and there is insufficient lookahead,
      * move the upper half to the lower one to make room in the upper half.
      */
-    if ((unsigned) EOF <= more) {
-        /* Very unlikely, but possible on 16 bit machine if strstart == 0
-         * and lookahead == 1 (input done one byte at time)
-         */
-        static_assert (2 < (unsigned) EOF);
-        more = (unsigned) EOF - 1;
-    } else if (strstart >= WSIZE+MAX_DIST) {
-        /* By the IN assertion, the window is not empty so we can't confuse
-         * more == 0 with more == 64K on a 16 bit machine.
-         */
+    static_assert (window_size < (unsigned int) EOF);
+    if (WSIZE + MAX_DIST <= strstart) {
         memcpy((char*)window, (char*)window+WSIZE, (unsigned)WSIZE);
         match_start -= WSIZE;
         strstart    -= WSIZE; /* we now have strstart >= MAX_DIST: */
diff --git a/gzip.h b/gzip.h
index 97ba182..e186e4e 100644
--- a/gzip.h
+++ b/gzip.h
@@ -58,8 +58,8 @@ typedef unsigned long  ulg;
 #define MAX_METHODS 9
 extern int method;         /* compression method */

-/* To save memory for 16 bit systems, some arrays are overlaid between
- * the various modules:
+/* To save memory (originally for 16 bit systems, though they are no longer
+ * supported), some arrays are overlaid between the various modules:
  * deflate:  prev+head   window      d_buf  l_buf  outbuf
  * unlzw:    tab_prefix  tab_suffix  stack  inbuf  outbuf
  * inflate:              window             inbuf
@@ -174,7 +174,7 @@ typedef int file_t;     /* Do not use stdio */
  */

 #define MAX_DIST  (WSIZE-MIN_LOOKAHEAD)
-/* In order to simplify the code, particularly on 16 bit machines, match
+/* To simplify the code, match
  * distances are limited to MAX_DIST instead of WSIZE.
  */

diff --git a/inflate.c b/inflate.c
index f68fbc7..e44f90a 100644
--- a/inflate.c
+++ b/inflate.c
@@ -122,8 +122,7 @@
 #include "gzip.h"
 #define slide window

-/* Huffman code lookup table entry--this entry is four bytes for machines
-   that have 16-bit pointers (e.g. PC's in the small or medium model).
+/* Huffman code lookup table entry.
    Valid extra bits are 0..13.  e == 15 is EOB (end of block), e == 16
    means that v is a literal, 16 < e < 32 means that v is a pointer to
    the next table, which codes e - 16 bits, and lastly e == 99 indicates
diff --git a/trees.c b/trees.c
index e5bd3d5..8db17a5 100644
--- a/trees.c
+++ b/trees.c
@@ -1014,8 +1014,7 @@ ct_tally (int dist, int lc)
         if (last_dist < last_lit/2 && out_length < in_length/2) return 1;
     }
     return (last_lit == LIT_BUFSIZE-1 || last_dist == DIST_BUFSIZE);
-    /* We avoid equality with LIT_BUFSIZE because of wraparound at 64K
-     * on 16 bit machines and because stored blocks are restricted to
+    /* Avoid equality with LIT_BUFSIZE because stored blocks are restricted to
      * 64K-1 bytes.
      */
 }
@@ -1073,7 +1072,7 @@ compress_block (ct_data *ltree, ct_data *dtree)
  * Set the file type to ASCII or BINARY, using a crude approximation:
  * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise.
  * IN assertion: the fields freq of dyn_ltree are set and the total of all
- * frequencies does not exceed 64K (to fit in an int on 16 bit machines).
+ * frequencies does not exceed UINT_MAX.
  */
 static void
 set_file_type ()