[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k4ncic46.fsf@basil.nowhere.org>
Date: Fri, 27 Aug 2010 12:27:53 +0200
From: Andi Kleen <andi@...stfloor.org>
To: Andreas Herrmann <herrmann.der.user@...glemail.com>
Cc: "H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Borislav Petkov <borislav.petkov@....com>,
Zhu Yi <yi.zhu@...el.com>,
"Luis R. Rodriguez" <lrodriguez@...eros.com>
Subject: Re: [PATCH] bitops: Provide generic sign_extend function (moving it out from wireless code)
Andreas Herrmann <herrmann.der.user@...glemail.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@...ux.intel.com -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists