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 11:01:59 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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=%d res=%d\n"
                      shift
                      (ash shift (lognot 0))))))
  =>

  shift=-1 res=-1
  shift=-2 res=-1
  shift=-3 res=-2
  shift=-4 res=-2
  shift=-5 res=-3
  shift=-6 res=-3
  shift=-7 res=-4
  shift=-8 res=-4
  shift=-9 res=-5
  shift=-10 res=-5
  
I don't quite understand the result; I may look into it later.

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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