aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bitops.h
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2015-11-23 03:04:05 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-11-23 03:04:05 -0500
commit92907cbbef8625bb3998d1eb385fc88f23c97a3f (patch)
tree15626ff9287e37c3cb81c7286d6db5a7fd77c854 /include/linux/bitops.h
parent15fbfccfe92c62ae8d1ecc647c44157ed01ac02e (diff)
parent1ec218373b8ebda821aec00bb156a9c94fad9cd4 (diff)
Merge tag 'v4.4-rc2' into drm-intel-next-queued
Linux 4.4-rc2 Backmerge to get at commit 1b0e3a049efe471c399674fd954500ce97438d30 Author: Imre Deak <imre.deak@intel.com> Date: Thu Nov 5 23:04:11 2015 +0200 drm/i915/skl: disable display side power well support for now so that we can proplery re-eanble skl power wells in -next. Conflicts are just adjacent lines changed, except for intel_fbdev.c where we need to interleave the changs. Nothing nefarious. Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r--include/linux/bitops.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index e63553386ae7..2b8ed123ad36 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -164,6 +164,8 @@ static inline __u8 ror8(__u8 word, unsigned int shift)
164 * sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit 164 * sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit
165 * @value: value to sign extend 165 * @value: value to sign extend
166 * @index: 0 based bit index (0<=index<32) to sign bit 166 * @index: 0 based bit index (0<=index<32) to sign bit
167 *
168 * This is safe to use for 16- and 8-bit types as well.
167 */ 169 */
168static inline __s32 sign_extend32(__u32 value, int index) 170static inline __s32 sign_extend32(__u32 value, int index)
169{ 171{
@@ -171,6 +173,17 @@ static inline __s32 sign_extend32(__u32 value, int index)
171 return (__s32)(value << shift) >> shift; 173 return (__s32)(value << shift) >> shift;
172} 174}
173 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 */
181static inline __s64 sign_extend64(__u64 value, int index)
182{
183 __u8 shift = 63 - index;
184 return (__s64)(value << shift) >> shift;
185}
186
174static inline unsigned fls_long(unsigned long l) 187static inline unsigned fls_long(unsigned long l)
175{ 188{
176 if (sizeof(l) == 4) 189 if (sizeof(l) == 4)