All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Jonathan Cameron <jic23@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: iio: ad2s1200: Fix sign extension
Date: Fri, 23 Jan 2015 09:56:15 +0100	[thread overview]
Message-ID: <54C20CAF.3010901@metafoo.de> (raw)
In-Reply-To: <1421968196-17193-1-git-send-email-linux@rasmusvillemoes.dk>

On 01/23/2015 12:09 AM, Rasmus Villemoes wrote:
> The line above makes vel a 12-bit quantity (st->rx[] is u8). The
> intention is to sign-extend vel using bit 11 as the sign bit. But
> because of C's promotion rules "vel = (vel << 4) >> 4;" is actually a
> no-op, since vel is promoted to int before the inner
> shift. sign_extend32 works equally well for 8 and 16 bits types, so
> use that.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

  reply	other threads:[~2015-01-23  8:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 23:09 [PATCH] staging: iio: ad2s1200: Fix sign extension Rasmus Villemoes
2015-01-23  8:56 ` Lars-Peter Clausen [this message]
2015-01-26 21:05   ` Jonathan Cameron

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=54C20CAF.3010901@metafoo.de \
    --to=lars@metafoo.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=pmeerw@pmeerw.net \
    /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.