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
This commit is contained in:
Bjoern A. Zeeb 2021-07-01 13:14:19 +00:00
parent b9d984e2c5
commit ea4dea8394

View file

@ -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_ */