git: 034475d66c7c - stable/13 - LinuxKPI: add sign_extend32()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 Nov 2021 00:02:20 UTC
The branch stable/13 has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=034475d66c7c52211636522f2f44de7e64d36a6b
commit 034475d66c7c52211636522f2f44de7e64d36a6b
Author: Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-07-01 13:14:19 +0000
Commit: Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-11-19 00:01:23 +0000
LinuxKPI: add sign_extend32()
Add sign_extend32() replicating the 64 version. This is needed by
the rtw88 driver.
(cherry picked from commit ea4dea83944ac6334d31e0364dd674eda250adde)
---
sys/compat/linuxkpi/common/include/linux/bitops.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h
index 49bfc4cc7414..0d7ab376e02d 100644
--- a/sys/compat/linuxkpi/common/include/linux/bitops.h
+++ b/sys/compat/linuxkpi/common/include/linux/bitops.h
@@ -412,4 +412,12 @@ sign_extend64(uint64_t value, int index)
return ((int64_t)(value << shift) >> shift);
}
+static inline uint32_t
+sign_extend32(uint32_t value, int index)
+{
+ uint8_t shift = 31 - index;
+
+ return ((int32_t)(value << shift) >> shift);
+}
+
#endif /* _LINUX_BITOPS_H_ */