Date: Fri, 19 Nov 2021 00:02:20 GMT From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 034475d66c7c - stable/13 - LinuxKPI: add sign_extend32() Message-ID: <202111190002.1AJ02KIu072103@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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_ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111190002.1AJ02KIu072103>