From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Douglas Lewan Newsgroups: gmane.emacs.help Subject: Re: Bit shift oddity? Date: Mon, 19 Oct 2020 11:19:20 -0400 Message-ID: References: <880f79e9-e2ea-b180-d83f-c3d47f5fb789@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17127"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Cc: help-gnu-emacs To: Gregory Heytings Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 19 17:23:48 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 1kUX0l-0004LB-6j for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 19 Oct 2020 17:23:47 +0200 Original-Received: from localhost ([::1]:51262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kUX0k-00021n-3z for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 19 Oct 2020 11:23:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43476) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kUWwa-0005uc-6l for help-gnu-emacs@gnu.org; Mon, 19 Oct 2020 11:19:28 -0400 Original-Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]:46204) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kUWwW-0003Uf-2i for help-gnu-emacs@gnu.org; Mon, 19 Oct 2020 11:19:27 -0400 Original-Received: by mail-il1-x135.google.com with SMTP id l16so425542ilt.13 for ; Mon, 19 Oct 2020 08:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=0cBKiyEiwFo+AVZwim3b1VpsMf+0JOGRIaPcdVZUe1E=; b=bzmUkXWbWx/lDYKCIROuVmF37z+uPYxMdpzKficsKOhwPkniO5c8b5cPKBoZzB5lia LZdHD65keTpFhfKv089puoEg9R8HeVx1dq8g7Kle4QEID6p6vEHq2tv8iRgAdKT1i6gM pJ2zSjKvlfFgHbCEerU9dL4MLD/5fqkLqOqMDbD7PsXP3kQdnuhOgrD+fMfGVNSeucqS HJ00VWQGo1fVr0l5T8K6wH2zlJCAwZ3DjUjWS2U+r1EIYW517CswEv+mhvX4CW5y3z8e JUfCd43xoVKZyohxvItqvjzFVmijgt/vh+Ee/fK0QkUq4CgMgCgMPUtk2jIv7T2sutHn +eIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=0cBKiyEiwFo+AVZwim3b1VpsMf+0JOGRIaPcdVZUe1E=; b=O7CpAeZkyAsEi9NkrKWpinynKILmjtx1WTYl9Ztw9eoh+I1S30kbbb3wZGPwU3M9XP uIh2QAIvkGDndirta4P8qY/g//FxYKQSacaPht0huEAb87gSAoV/2/KLU6iokRfZbDL0 seqZLea9rM8JSgBvVTRhkMSsHKwIUiFeAy2+U611WZZlVpdSFNMT0RvrB1BaPkAYGkU6 POY4N+kcwB48rNRzY34F4ttaCRPpvBiz73u+7wEjLCraefa1gQbAokuCzLZJDqNBp2S2 Ogwq4WwuQY7Drs5GOLz+YwyrMfSYEFe95pIocIZ5x/d+SxgPDXLhk/JRApf4MvMrNaeT m5tA== X-Gm-Message-State: AOAM530SIlFfU3Xml9guOLe7fDJTyWEKFsxjCzQcFYsfHx8MntQKIz7e 12Thy13ek9jUQPwKCEDmTilpvNPw7A== X-Google-Smtp-Source: ABdhPJxZFNGgmH5Ea3Oxy2FNSTzkwF+XCAuu9i78UpxcLwey034pkKhCBJyLW5aNNGNUtJPIqbznuA== X-Received: by 2002:a05:6e02:5ad:: with SMTP id k13mr368080ils.71.1603120762617; Mon, 19 Oct 2020 08:19:22 -0700 (PDT) Original-Received: from [192.168.43.104] ([172.58.239.127]) by smtp.gmail.com with ESMTPSA id g8sm22434ioh.54.2020.10.19.08.19.21 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2020 08:19:22 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::135; envelope-from=d.lewan2000@gmail.com; helo=mail-il1-x135.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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:124579 Archived-At: Nice. Thank you. On 10/19/20 5:23 AM, Gregory Heytings wrote: > >> >> I see the following: >> >>   ELISP> (= (lsh -1 (lognot 0)) (lsh -2 (lognot 0))) >> >>   t >> >>   ELISP> (= (lsh -1 (lognot 0)) (lsh -3 (lognot 0))) >> >>   nil >> >> The first seems odd to me. Is it really what's expected? >> > > Yes, it's what is expected.  The docstring of lsh says: > > "(lsh VALUE COUNT) ... If COUNT is negative, shifting is actually to > the right. In this case, if VALUE is a negative fixnum treat it as > unsigned ..." > > -1 (decimal) = 111...111 (binary) > -2 (decimal) = 111...110 (binary) > > If you shift these two numbers to the right, you get the exact same > result: 011...111, that is, `most-positive-fixnum'. -- ,Doug d.lewan2000@gmail.com (908) 720 7908 You know, it's amazing how much closer to 0 that 8 067 332 is than 15 is. (2020 Oct 18)