mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
lima: fix stringop-overflow warning
New versions of gcc output a warning about this code, apparently because of the mix of signed and unsigned operations in the loop condition. Rework the types to fix the warning. Signed-off-by: Erico Nunes <nunes.erico@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22129>
This commit is contained in:
parent
4f42d3b843
commit
1eb2359bbd
1 changed files with 7 additions and 7 deletions
|
|
@ -765,16 +765,16 @@ static const int ppir_codegen_field_size[] = {
|
|||
};
|
||||
|
||||
static void
|
||||
bitcopy(char *src, char *dst, unsigned bits, unsigned src_offset)
|
||||
bitcopy(unsigned char *src, unsigned char *dst, unsigned bits, unsigned src_offset)
|
||||
{
|
||||
src += src_offset / 8;
|
||||
src_offset %= 8;
|
||||
|
||||
for (int b = bits; b > 0; b -= 8, src++, dst++) {
|
||||
unsigned char out = ((unsigned char) *src) >> src_offset;
|
||||
for (unsigned b = bits; b > 0; b -= MIN2(b, 8), src++, dst++) {
|
||||
unsigned char out = *src >> src_offset;
|
||||
if (src_offset > 0 && src_offset + b > 8)
|
||||
out |= ((unsigned char) *(src + 1)) << (8 - src_offset);
|
||||
*dst = (char) out;
|
||||
out |= *(src + 1) << (8 - src_offset);
|
||||
*dst = out;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -783,11 +783,11 @@ ppir_disassemble_instr(uint32_t *instr, unsigned offset, FILE *fp)
|
|||
{
|
||||
ppir_codegen_ctrl *ctrl = (ppir_codegen_ctrl *) instr;
|
||||
|
||||
char *instr_code = (char *) (instr + 1);
|
||||
unsigned char *instr_code = (unsigned char *) (instr + 1);
|
||||
unsigned bit_offset = 0;
|
||||
bool first = true;
|
||||
for (unsigned i = 0; i < ppir_codegen_field_shift_count; i++) {
|
||||
char code[12];
|
||||
unsigned char code[12];
|
||||
|
||||
if (!((ctrl->fields >> i) & 1))
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue