git: ea4dea83944a - main - LinuxKPI: add sign_extend32()
Bjoern A. Zeeb
bz at FreeBSD.org
Tue Jul 27 15:07:30 UTC 2021
The branch main has been updated by bz:
URL: https://cgit.FreeBSD.org/src/commit/?id=ea4dea83944ac6334d31e0364dd674eda250adde
commit ea4dea83944ac6334d31e0364dd674eda250adde
Author: Bjoern A. Zeeb <bz at FreeBSD.org>
AuthorDate: 2021-07-01 13:14:19 +0000
Commit: Bjoern A. Zeeb <bz at FreeBSD.org>
CommitDate: 2021-07-27 15:03:38 +0000
LinuxKPI: add sign_extend32()
Add sign_extend32() replicating the 64 version. This is needed by
the rtw88 driver.
MFC after: 10 days
Reviewed by: imp, emaste, hselasky
Differential Revision: https://reviews.freebsd.org/D30979
---
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_ */
More information about the dev-commits-src-all
mailing list