Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/dxil.c:
return value_count; }
+static size_t sm6_parser_get_value_index(const struct sm6_parser *sm6, uint64_t idx) +{ + size_t i; + + /* The value relative index is apparently always 32 bits, so forward refs do not + * have the upper 32 bits set to 1. */ + i = (uint32_t)sm6->value_count - (uint32_t)idx; + + /* This may underflow to produce a forward reference, but it must not exceeed the final value count + * and should not have > 32 significant bits. */ + if ((idx > UINT32_MAX && idx < UINT64_MAX - INT32_MAX) || i >= sm6->cur_max_value)
Hhm, from the comment it seems that `idx` should always be contained in 32 bit, but the code apparently allows it to be bigger, provided that it's larger than `UINT64_MAX - INT32_MAX`. What's the actual intent? -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/283#note_40303