mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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:
parent
b9d984e2c5
commit
ea4dea8394
1 changed files with 8 additions and 0 deletions
|
|
@ -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_ */
|
||||
|
|
|
|||
Loading…
Reference in a new issue