On 5/8/19 7:56 AM, Yoshinori Sato wrote:
> +static inline uint16_t extract16(uint32_t value, int start, int length)
s/uint32_t/uint16_t/
Aside from the possible value of the more restrictive asserts, I'm not sure
what advantage you see in these routines. All arithmetic in C is promoted to
type "int", which for all supported hosts is 32-bits.
This suggests an implementation for these functions as
assert(...);
return extract32(value, start, length);
because otherwise the (32 - length) subexpression might at first glance appear
to be a cut-and-paste bug. Whereas it's really required by the larger
subexpression.
r~