From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Unknown Newsgroups: gmane.emacs.bugs Subject: bug#45562: [PATCH] Fix "comparison always the same" warnings found by lgtm Date: Fri, 01 Jan 2021 12:37:43 +0100 Message-ID: References: <83zh1ugj30.fsf@gnu.org> <87h7o0c3sx.fsf@gnus.org> Reply-To: =?UTF-8?Q?Reply-to=3A_Daniel_Mart=C3=83=C2=ADn_=3Cmardani29=40yahoo=2Ees?= =?UTF-8?Q?=3E=0A?= Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5623"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (darwin) Cc: 45562@debbugs.gnu.org, Stefan Kangas To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 01 12:38:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kvIl0-0001Nv-HH for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Jan 2021 12:38:10 +0100 Original-Received: from localhost ([::1]:41926 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kvIkz-0003A5-K1 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Jan 2021 06:38:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kvIks-00039k-C3 for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2021 06:38:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43987) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kvIks-000256-4v for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2021 06:38:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kvIks-00015k-2o for bug-gnu-emacs@gnu.org; Fri, 01 Jan 2021 06:38:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Jan 2021 11:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45562 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45562-submit@debbugs.gnu.org id=B45562.16095010754183 (code B ref 45562); Fri, 01 Jan 2021 11:38:02 +0000 Original-Received: (at 45562) by debbugs.gnu.org; 1 Jan 2021 11:37:55 +0000 Original-Received: from localhost ([127.0.0.1]:55533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvIkl-00015P-C1 for submit@debbugs.gnu.org; Fri, 01 Jan 2021 06:37:55 -0500 Original-Received: from sonic305-19.consmr.mail.ir2.yahoo.com ([77.238.177.81]:38227) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kvIkj-00015C-GI for 45562@debbugs.gnu.org; Fri, 01 Jan 2021 06:37:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1609501067; bh=dyA/cZnl8nSrqhQUIEz49mksWi5G9bxT04aZnUqoDeE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject; b=nBhzOV7uP78kf1aUwfXeodpJGLInXKnjM5ShcvqNQIYN9Avnw+ktfrxjMjB6d8rN+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H.xK5tGlEqD6B43RlNK9EFaI2hCy84YyJYeTiaxpcIHPZddVvxK0FMO0mFHIbDeisZfYGxU m_SsEbleW1QWfcJsCRNo3KldUtMtrk_tK3tRmo0W31UYy4hAsIhudEXGH3kw1i23p9_2ymf9XYs5 zCHXX09VStPmNuLMD46n_2pkBLDDAzflekwPN3fA5Y74mPCprzegtMs42CT7wlR7CIfY_R1qKY7f .1pygA.JeMXJZBFKJd00rrfdBVxTGQlkln70oYY9EACN..qd8L_OQWPn7z0GwkpP1ZS5Qkbbsl4. Uk09plWZWphohfR0pBeYM2OeCP9KLOExmCKWnmLp4k875mvc7qhDco2jVJ5P_DJoblroeZVzIs3i uZK1v4ZgsMeHLo3Pqdvxvwn_H0khJI12Fy83jU9_Q0CWbtOKXxEVRhvVOuBHcNrpPrqbHVW7Knrj OaGdHdWSorqOyOVglMzaAWADMVbZXEb3ZF3BDznIk9KdWgMR9jote.qK2duZsGhH3H9i8jn07l7X s8wGhL12B_QQzgF8L1FFwskN.5jwpcKuuBMKOiOEpH Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ir2.yahoo.com with HTTP; Fri, 1 Jan 2021 11:37:47 +0000 Original-Received: by smtp417.mail.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID c9e694c2f062fee3945c766506d3bd40; Fri, 01 Jan 2021 11:37:44 +0000 (UTC) In-Reply-To: <87h7o0c3sx.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 01 Jan 2021 12:08:46 +0100") X-Mailer: WebService/1.1.17278 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Apache-HttpAsyncClient/4.1.4 (Java/11.0.8) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Original-From: Xref: news.gmane.io gmane.emacs.bugs:197123 Archived-At: Lars Ingebrigtsen writes: > Eli Zaretskii writes: > >>> --- a/src/alloc.c >>> +++ b/src/alloc.c >>> @@ -4001,7 +4001,7 @@ memory_full (size_t nbytes) >>> { >>> if (i == 0) >>> free (spare_memory[i]); >>> - else if (i >= 1 && i <= 4) >>> + else if (i <= 4) >>> lisp_align_free (spare_memory[i]); >>> else >>> lisp_free (spare_memory[i]); >> >> This is an optimization better left to the compiler, IMO. > > I think the change made the code slightly clearer, though? You don't > have to think about whether there's anything in the range between 0 and >>= 1. I think it depends on the programmer. To me, the original code makes more clear that the branch runs when i is in the [1..4] range, in a mathematical sense.