18 Oct
2017
18 Oct
'17
7:58 a.m.
On 18 October 2017 at 00:25, Józef Kucia <jkucia(a)codeweavers.com> wrote:
+static inline DWORD wined3d_extract_bits(const DWORD *bitstream, + unsigned int offset, unsigned int count) +{ + const unsigned int word_bit_count = sizeof(*bitstream) * CHAR_BIT; + const unsigned int idx = offset / word_bit_count; + const unsigned int shift = offset % word_bit_count; + DWORD mask = (1u << count) - 1; It's not an issue in this patch, but note that the above doesn't work for count > 31. We probably don't care about count > 32, but we may care about count == 32. Specifically, "1u << 32" is undefined, but in practice tends to evaluate as "1u << 0".