diff options
| author | Ingo Molnar <mingo@kernel.org> | 2024-04-03 10:13:09 +0300 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2024-04-03 10:13:09 +0300 |
| commit | 9b4e528557944dff694c8afa5a8912de81503bf2 (patch) | |
| tree | 7d4ff38fbf55e1d32e3384cac0ae2fc80d4ae179 /tools/include/linux/bitops.h | |
| parent | dfbc411e0a5ea72fdd563b2c7d627e9d993d865c (diff) | |
| parent | 39cd87c4eb2b893354f3b850f916353f2658ae6f (diff) | |
| download | linux-9b4e528557944dff694c8afa5a8912de81503bf2.tar.xz | |
Merge tag 'v6.9-rc2' into perf/core, to pick up dependent commits
Pick up fixes that followup patches are going to depend on.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
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 |
