Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104119
CC: <mesa-stable@lists.freedesktop.org>
CC: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
unsigned base = src0, insert = src1;
int offset = src2, bits = src3;
if (bits == 0) {
- dst = 0;
+ dst = base;
} else if (offset < 0 || bits < 0 || bits + offset > 32) {
dst = 0;
} else {
unsigned mask = ((1ull << bits) - 1) << offset;
- dst = (base & ~mask) | ((insert << bits) & mask);
+ dst = (base & ~mask) | ((insert << offset) & mask);
}
""")