From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.help Subject: Re: Bit shift oddity? Date: Mon, 19 Oct 2020 11:01:59 +0200 Message-ID: <20201019090159.GA11667@tuxteam.de> References: <880f79e9-e2ea-b180-d83f-c3d47f5fb789@gmail.com> <20201019070610.GB9024@tuxteam.de> <3b4def4b-28c5-d549-0645-0056f0709549@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Nq2Wo0NMKNjxTN9z" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33269"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 19 11:02:30 2020 Return-path: Envelope-to: geh-help-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 1kUR3m-0008Zf-6g for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 19 Oct 2020 11:02:30 +0200 Original-Received: from localhost ([::1]:45790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kUR3l-0006jJ-7Q for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 19 Oct 2020 05:02:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUR3J-0006j1-Pl for help-gnu-emacs@gnu.org; Mon, 19 Oct 2020 05:02:02 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:59446) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1kUR3H-0005Hj-I7 for help-gnu-emacs@gnu.org; Mon, 19 Oct 2020 05:02:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:To:Date; bh=3AYxIUwOZ1k92i/UdJh99kkamA3d9h2jyZ6Kn4sguA4=; b=t5sY9JhEtTKo8JjJc4WGk/QOI4eOy1HH7BC1/qd0aPRofczky9vcejeHHVGQNz+VvEa7SaSjl2Bc7+9AMIDI6uMF1iLncVceECGrUnzFOkYB6qJWxQreEXdUBaRJpXNpPfqMYWdNiFmdB8d1q7/i377w80wkCzLyChg1K7snRIiXt81kUuK70Rc69OTTTKrweNK72BhCK+yfv2hbu2vJCzMrUG75L5LaD8/6HwA6CNZJ8yERxwklfOBxDUfJPr1yy7QhZqW63mpMGzUg/Bt9hlDa1KwAd24XNJ5w86F+f5n9AfxbUi3w+vBLa3SqdkCd4/lJA1aS+LlvxYs3MBLYLA==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1kUR3H-0003u7-Ei for help-gnu-emacs@gnu.org; Mon, 19 Oct 2020 11:01:59 +0200 Content-Disposition: inline In-Reply-To: <3b4def4b-28c5-d549-0645-0056f0709549@gmail.com> Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/19 02:57:31 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:124574 Archived-At: --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 19, 2020 at 03:48:01AM -0400, Douglas Lewan wrote: > Thanks. I see the same behavior with (ash). Well, it's not exactly the "same behaviour", the inequalities seem to be the same, but the intermediate numbers are not. FWIW: (dotimes (i 10) (let ((shift (- -1 i))) (insert (format "shift=3D%d res=3D%d\n" shift (ash shift (lognot 0)))))) =3D> shift=3D-1 res=3D-1 shift=3D-2 res=3D-1 shift=3D-3 res=3D-2 shift=3D-4 res=3D-2 shift=3D-5 res=3D-3 shift=3D-6 res=3D-3 shift=3D-7 res=3D-4 shift=3D-8 res=3D-4 shift=3D-9 res=3D-5 shift=3D-10 res=3D-5 =20 I don't quite understand the result; I may look into it later. Cheers - t --Nq2Wo0NMKNjxTN9z Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAl+NVgcACgkQBcgs9XrR2kanEACfT40D1ZAzAS6JuwSAZYbYbiR7 0+cAnRpozC4tgVfXeR8iRYKBi5FZcptu =XWdF -----END PGP SIGNATURE----- --Nq2Wo0NMKNjxTN9z--