help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bit shift oddity?


From: tomas
Subject: Re: Bit shift oddity?
Date: Mon, 19 Oct 2020 09:06:10 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, Oct 18, 2020 at 08:19:24PM -0400, Douglas Lewan 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?

The manual for lsh talks about "quirky behaviour" of lsh when
both arguments are negative, in the name of backward-compatibility
and suggests resorting to ash. Cf. the Emacs lisp manual "3.8
Bitwise Operations on Integers"

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]