diff options
| author | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-01-16 16:21:04 -0500 |
|---|---|---|
| committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-01-16 16:21:04 -0500 |
| commit | f652f6c5b7cfdf139f4155d78f397e99ae1c4acc (patch) | |
| tree | 71c6344688bf56ea6aaf18c586ab69ff4f077ade /include/linux/bitops.h | |
| parent | 140e3008e7fe1526cbb12f8f07dbc273ac713b75 (diff) | |
| parent | c66ac9db8d4ad9994a02b3e933ea2ccc643e1fe5 (diff) | |
Merge branch 'master' of /pub/scm/linux/kernel/git/jejb/scsi-post-merge-2.6 into for-linus
Diffstat (limited to 'include/linux/bitops.h')
| -rw-r--r-- | include/linux/bitops.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 827cc95711ef..2184c6b97aeb 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
| @@ -109,6 +109,17 @@ static inline __u8 ror8(__u8 word, unsigned int shift) | |||
| 109 | return (word >> shift) | (word << (8 - shift)); | 109 | return (word >> shift) | (word << (8 - shift)); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | /** | ||
| 113 | * sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit | ||
| 114 | * @value: value to sign extend | ||
| 115 | * @index: 0 based bit index (0<=index<32) to sign bit | ||
| 116 | */ | ||
| 117 | static inline __s32 sign_extend32(__u32 value, int index) | ||
| 118 | { | ||
| 119 | __u8 shift = 31 - index; | ||
| 120 | return (__s32)(value << shift) >> shift; | ||
| 121 | } | ||
| 122 | |||
| 112 | static inline unsigned fls_long(unsigned long l) | 123 | static inline unsigned fls_long(unsigned long l) |
| 113 | { | 124 | { |
| 114 | if (sizeof(l) == 4) | 125 | if (sizeof(l) == 4) |
