diff options
| author | 2024-04-02 08:17:13 -0400 | |
|---|---|---|
| committer | 2024-04-02 08:17:13 -0400 | |
| commit | 5add703f6acad1c63f8a532b6de56e50d548e904 (patch) | |
| tree | be39a82716119cd8b7cf7e2734baf8cd9a80ceb7 /tools/include/linux/bitops.h | |
| parent | drm/i915/psr: Do not write ALPM configuration for PSR1 or DP2.0 Panel Replay (diff) | |
| parent | Linux 6.9-rc2 (diff) | |
| download | wireguard-linux-5add703f6acad1c63f8a532b6de56e50d548e904.tar.xz wireguard-linux-5add703f6acad1c63f8a532b6de56e50d548e904.zip | |
Merge drm/drm-next into drm-intel-next
Catching up on 6.9-rc2
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'tools/include/linux/bitops.h')
| -rw-r--r-- | tools/include/linux/bitops.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/include/linux/bitops.h b/tools/include/linux/bitops.h index f18683b95ea6..7319f6ced108 100644 --- a/tools/include/linux/bitops.h +++ b/tools/include/linux/bitops.h @@ -87,4 +87,15 @@ static inline __u32 rol32(__u32 word, unsigned int shift) return (word << shift) | (word >> ((-shift) & 31)); } +/** + * sign_extend64 - sign extend a 64-bit value using specified bit as sign-bit + * @value: value to sign extend + * @index: 0 based bit index (0<=index<64) to sign bit + */ +static __always_inline __s64 sign_extend64(__u64 value, int index) +{ + __u8 shift = 63 - index; + return (__s64)(value << shift) >> shift; +} + #endif |
