aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMartin Kepplinger <martink@posteo.de>2015-11-06 16:30:58 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-06 17:50:42 -0800
commite2eb53aa96754b97d158eff884dde88abbad925e (patch)
tree0159c242d120da9cd02dc3d59a8b7787da811fb8 /include
parentcd2c3e7f94f3d8210320bfb9b5712bdcbb12f8db (diff)
downloadlinux-stericsson-e2eb53aa96754b97d158eff884dde88abbad925e.tar.gz
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: Martin Kepplinger <martin.kepplinger@theobroma-systems.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Ingo Molnar <mingo@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: George Spelvin <linux@horizon.com> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Maxime Coquelin <maxime.coquelin@st.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Yury Norov <yury.norov@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/bitops.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index e63553386ae7..5629923a8701 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -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)
{