lkml.org 
[lkml]   [2010]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH] bitops: Provide generic sign_extend function (moving it out from wireless code)
    Date
    Andreas Herrmann <herrmann.der.user@googlemail.com> writes:
    >
    > +/**
    > + * sign_extend - Sign extend a value using specified bit as sign-bit
    > + * @value: value to sign extend
    > + * @index: 0 based bit index (0<=index<32) to sign bit
    > + */
    > +static inline __s32 sign_extend(__u32 value, int index)
    > +{
    > + __u8 shift = 31 - index;
    > + return (__s32)(value << shift) >> shift;
    > +}

    If it only handles 32bit please call it sign_extend32

    -Andi

    --
    ak@linux.intel.com -- Speaking for myself only.


    \
     
     \ /
      Last update: 2010-08-27 12:31    [W:0.019 / U:31.808 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site