From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 46D883858C83; Tue, 19 Apr 2022 22:23:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 46D883858C83 From: "mark at klomp dot org" To: bzip2-devel@sourceware.org Subject: =?UTF-8?B?W0J1ZyBiemlwMi8yODkwNF0gbGliYnppcDI6IOKAmGNvc3RbM10=?= =?UTF-8?B?4oCZIG1heSBiZSB1c2VkIHVuaW5pdGlhbGl6ZWQgaW4gdGhpcyBmdW5jdGlv?= =?UTF-8?B?biBbLVdtYXliZS11bmluaXRpYWxpemVkXQ==?= Date: Tue, 19 Apr 2022 22:23:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: bzip2 X-Bugzilla-Component: bzip2 X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: mark at klomp dot org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: nobody at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: bzip2-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bzip2-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Apr 2022 22:23:50 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D28904 --- Comment #2 from Mark Wielaard --- A different solution might be to use the constant BZ_N_GROUPS instead of the variable nGroups when resetting the arrays: diff --git a/compress.c b/compress.c index 5dfa002..2dc5dc1 100644 --- a/compress.c +++ b/compress.c @@ -321,7 +321,7 @@ void sendMTFValues ( EState* s ) ---*/ for (iter =3D 0; iter < BZ_N_ITERS; iter++) { - for (t =3D 0; t < nGroups; t++) fave[t] =3D 0; + for (t =3D 0; t < BZ_N_GROUPS; t++) fave[t] =3D 0; for (t =3D 0; t < nGroups; t++) for (v =3D 0; v < alphaSize; v++) @@ -353,7 +353,7 @@ void sendMTFValues ( EState* s ) Calculate the cost of this group as coded by each of the coding tables. --*/ - for (t =3D 0; t < nGroups; t++) cost[t] =3D 0; + for (t =3D 0; t < BZ_N_GROUPS; t++) cost[t] =3D 0; if (nGroups =3D=3D 6 && 50 =3D=3D ge-gs+1) { /*--- fast track the common case ---*/ Which might also help the compiler to simply zero the whole (6 element) arr= ays in one go (the common case), instead of having to check whether nGroups is smaller in this particular case. --=20 You are receiving this mail because: You are on the CC list for the bug.=