diff options
-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 5629923a8701..2b8ed123ad36 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -173,6 +173,17 @@ static inline __s32 sign_extend32(__u32 value, int index) | |||
173 | return (__s32)(value << shift) >> shift; | 173 | return (__s32)(value << shift) >> shift; |
174 | } | 174 | } |
175 | 175 | ||
176 | /** | ||
177 | * sign_extend64 - sign extend a 64-bit value using specified bit as sign-bit | ||
178 | * @value: value to sign extend | ||
179 | * @index: 0 based bit index (0<=index<64) to sign bit | ||
180 | */ | ||
181 | static inline __s64 sign_extend64(__u64 value, int index) | ||
182 | { | ||
183 | __u8 shift = 63 - index; | ||
184 | return (__s64)(value << shift) >> shift; | ||
185 | } | ||
186 | |||
176 | static inline unsigned fls_long(unsigned long l) | 187 | static inline unsigned fls_long(unsigned long l) |
177 | { | 188 | { |
178 | if (sizeof(l) == 4) | 189 | if (sizeof(l) == 4) |