All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Stefan Weil <sw@weilnetz.de>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 0/3] Add and use bit rotate functions
Date: Thu, 12 Sep 2013 12:23:51 -0700	[thread overview]
Message-ID: <523214C7.4090303@twiddle.net> (raw)
In-Reply-To: <1379013193-20691-1-git-send-email-sw@weilnetz.de>

On 09/12/2013 12:13 PM, Stefan Weil wrote:
> The first patch was already sent to qemu-devel and is only included
> here because patch 3 is based on it. Only patch 1 is needed for qemu-stable.
> 
> It looks like shift values of 0 or 32/64 work as expected because
> the compiler "knows" the pattern used to implement the rotate operation,
> so the code does not need special handling of some shift values.

Thinking about this closer, the only two behaviors I know of for
x >> n, n >= w, w = width of x, are: shift modulo w, or zero.

Both cases work for this usage:

   x << 0 | x >> 32
   = x | (x >> 0)	modulo
   = x | x
   = x

   = x | 0		zero
   = x

AFAIK we never actually observe missile launch as a side effect
of an out of range shift.  And with that in mind, I think the
existing implementation of rotate is fine.


r~

      parent reply	other threads:[~2013-09-12 19:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 19:13 [Qemu-devel] [PATCH 0/3] Add and use bit rotate functions Stefan Weil
2013-09-12 19:13 ` [Qemu-devel] [PATCH 1/3] tci: Add implementation of rotl_i64, rotr_i64 Stefan Weil
2013-09-12 19:13 ` [Qemu-devel] [PATCH 2/3] bitops: Add rotate functions (rol8, ror8, ...) Stefan Weil
2013-09-12 19:24   ` Richard Henderson
2013-09-12 19:13 ` [Qemu-devel] [PATCH 3/3] misc: Use new rotate functions Stefan Weil
2013-09-12 19:25   ` Richard Henderson
2013-09-12 19:23 ` Richard Henderson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=523214C7.4090303@twiddle.net \
    --to=rth@twiddle.net \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.