Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/bitops.h
Show First 20 Lines • Show All 406 Lines • ▼ Show 20 Lines | |||||
static inline uint64_t | static inline uint64_t | ||||
sign_extend64(uint64_t value, int index) | sign_extend64(uint64_t value, int index) | ||||
{ | { | ||||
uint8_t shift = 63 - index; | uint8_t shift = 63 - index; | ||||
return ((int64_t)(value << shift) >> shift); | return ((int64_t)(value << shift) >> shift); | ||||
} | } | ||||
static inline uint32_t | |||||
sign_extend32(uint32_t value, int index) | |||||
hselasky: should index be uint8_t aswell? | |||||
Not Done Inline ActionsThis matches the function signature from Linux emaste: This matches the function signature from Linux | |||||
Done Inline Actions@emaste "this" being "int" or "uint8_t"? The 64bit version above only had a "int" and I went by that, bz: @emaste "this" being "int" or "uint8_t"? The 64bit version above only had a "int" and I went… | |||||
{ | |||||
uint8_t shift = 31 - index; | |||||
return ((int32_t)(value << shift) >> shift); | |||||
} | |||||
#endif /* _LINUX_BITOPS_H_ */ | #endif /* _LINUX_BITOPS_H_ */ |
should index be uint8_t aswell?