Commit e2eb53aa authored by Martin Kepplinger's avatar Martin Kepplinger Committed by Linus Torvalds

bitops.h: improve sign_extend32()'s documentation

It is often overlooked that sign_extend32(), despite its name, is safe to
use for 16 and 8 bit types as well.  This should help prevent sign
extension being done manually some other way.
Signed-off-by: default avatarMartin Kepplinger <>
Cc: Peter Zijlstra <>
Cc: Ingo Molnar <>
Cc: Arnaldo Carvalho de Melo <>
Cc: Thomas Gleixner <>
Cc: "H. Peter Anvin" <>
Cc: George Spelvin <>
Cc: Rasmus Villemoes <>
Cc: Maxime Coquelin <>
Cc: Denys Vlasenko <>
Cc: Yury Norov <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent cd2c3e7f
......@@ -164,6 +164,8 @@ static inline __u8 ror8(__u8 word, unsigned int shift)
* sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit
* @value: value to sign extend
* @index: 0 based bit index (0<=index<32) to sign bit
* This is safe to use for 16- and 8-bit types as well.
static inline __s32 sign_extend32(__u32 value, int index)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment