qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2 for 2.5] QEMU does not care about left shifts of signed negative values
Date: Tue, 17 Nov 2015 16:47:29 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Laszlo Ersek <address@hidden> writes:

> I accept this is a defensible, maybe even reasonable choice to make in
> the QEMU project. On the other hand, I personally cannot stop hating
> shifting negative values (any direction) -- indeed, the *original* code
> from <https://github.com/madler/zlib/pull/112> makes me barf too.
>
> Therefore,
>
> Grudgingly-reviewed-by: Laszlo Ersek <address@hidden>
>
> (I realize the flag for the pointer wraparound has been separated; this
> is strictly about shifts.)

What's so abhorrent about shifting negative values?  I know machines
with signed integer representations other than twos complement exist, as
do machines that can't do both logical and arithmetic shifts.  Mostly
inside computer museums, though.

C was standardized at a time when keeping the language sufficiently
loose to permit efficient implementation on these oddball machines made
a lot more sense than it does now.  Making it undefined behavior went
too far, though.  Implementation-defined or unspecified behavior would
have sufficed.

Learn to stop worrying and love the signed shifts :)



reply via email to

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