[hackers] [flate] +LzEnd, -accidental p4 opt || nsz

From: <hg_AT_suckless.org>
Date: Fri, 21 Aug 2009 13:50:14 +0000 (UTC)

changeset: 106:5b7ed8672f25
user: nsz <nszabolcs_AT_gmail.com>
date: Tue Aug 18 14:58:57 2009 +0200
files: Makefile deflate.c
description:
+LzEnd, -accidental p4 opt

diff -r 3f34d3957f8f -r 5b7ed8672f25 Makefile
--- a/Makefile Tue Aug 18 14:00:55 2009 +0200
+++ b/Makefile Tue Aug 18 14:58:57 2009 +0200
@@ -1,5 +1,5 @@
 #CFLAGS=-g -Wall -ansi -pedantic
-CFLAGS=-O3 -march=pentium4 -Wall -ansi -pedantic
+CFLAGS=-O3 -Wall -ansi -pedantic
 LDFLAGS=
 SRC=inflate.c inflate_example.c inflate_simple.c \
     deflate.c deflate_example.c
diff -r 3f34d3957f8f -r 5b7ed8672f25 deflate.c
--- a/deflate.c Tue Aug 18 14:00:55 2009 +0200
+++ b/deflate.c Tue Aug 18 14:58:57 2009 +0200
@@ -24,6 +24,7 @@
         HistSize = 2*WinSize, /* history buffer size (64K, indexed with ushort) */
         DstSize = WinSize + MaxMatch + 6, /* worst case compressed block size */
         LzSize = 1 << 13, /* lz buffer size */
+ LzEnd = LzSize - 2, /* guard that lzbuf does not overflow in the next iteration */
         LzLitFlag = 1 << 15 /* marks literal run length in lz buffer */
 };
 
@@ -539,7 +540,7 @@
 static int endblock(State *s) {
         int n;
 
- if (s->pos >= EndPos || s->lz - s->lzbuf > LzSize - 3 || (s->eof && s->avail == 0)) {
+ if (s->pos >= EndPos || s->lz - s->lzbuf >= LzEnd || (s->eof && s->avail == 0)) {
                 /* deflate block */
                 flushlit(s);
                 if (s->prevm.len)
Received on Fri Aug 21 2009 - 13:50:14 UTC

This archive was generated by hypermail 2.2.0 : Fri Aug 21 2009 - 14:00:11 UTC