lkml.org 
[lkml]   [2015]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: iio: ad2s1200: Fix sign extension
On 23/01/15 08:56, Lars-Peter Clausen wrote:
> 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>
Applied to fixes-togreg branch of iio.git.

Thanks,

Jonathan



\
 
 \ /
  Last update: 2015-01-26 22:21    [W:0.051 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site