shader_recompiler: Use initializer_list for bitfield insert helper.

This commit is contained in:
squidbus 2025-02-06 18:07:15 -08:00
parent f69b123d7b
commit 64e2b56177

View File

@ -28,17 +28,19 @@ static std::array<Id, sizeof...(Args)> ExtractBitFields(EmitContext& ctx, const
}
template <typename... Args>
static Id InsertBitFields(EmitContext& ctx, const std::vector<Id>& values, const Args... args) {
static Id InsertBitFields(EmitContext& ctx, const std::initializer_list<Id> values,
const Args... args) {
Id result{};
u32 i = 0;
auto it = values.begin();
(
[&] {
if (i == 0) {
result = values[i++];
if (it == values.begin()) {
result = *it;
} else {
result = ctx.OpBitFieldInsert(ctx.U32[1], result, values[i++],
ctx.ConstU32(args.offset), ctx.ConstU32(args.size));
result = ctx.OpBitFieldInsert(ctx.U32[1], result, *it, ctx.ConstU32(args.offset),
ctx.ConstU32(args.size));
}
++it;
}(),
...);
return result;