emacs-devel
[Top][All Lists]
Advanced

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

Re: master ac1d15e95c 1/2: ; * src/data.c (Fash): More precise doc strin


From: Mattias Engdegård
Subject: Re: master ac1d15e95c 1/2: ; * src/data.c (Fash): More precise doc string
Date: Tue, 19 Jul 2022 19:46:24 +0200

19 juli 2022 kl. 17.54 skrev Eli Zaretskii <eliz@gnu.org>:

> The operation is "bit shift", so
> the most natural way of describing it is in terms of shifting bits.
> No?

Not necessarily. The user inputs numbers and gets a number out, not bit 
sequences, so it makes sense to describe the behaviour in arithmetic terms. 
(We're not describing a processor instruction that manipulates registers; `ash` 
is an operation on mathematical integers.)

A bitwise description would require knowledge of two's complement 
representation which you dismissed earlier. If it's acceptable to complement 
the arithmetic description with something that refers to such representation, 
then we could have:

  If we view VALUE as a binary two's complement number, then shifting left 
introduce new 0-bits to the right and shifting right remove rightmost bits.
  Since negative numbers have an infinite supply of 1-bits to the left, a 
negative number remains negative no matter how far it is shifted in either 
direction.





reply via email to

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