Both functions return uint64_t, so I expect the masking/shifting should
be done on 64-bit types.
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
assert(min <= v && v <= max);
#endif
- const int32_t int_val = roundf(v * factor);
+ const int64_t int_val = llroundf(v * factor);
const uint64_t mask = ~0ull >> (64 - (end - start + 1));
return (int_val & mask) << start;
assert(min <= v && v <= max);
#endif
- const uint32_t uint_val = roundf(v * factor);
+ const uint64_t uint_val = llroundf(v * factor);
return uint_val << start;
}