mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
zink: fixup signedness of subtraction
I'm not even going to pretend that I grok this code, but since we take
the abs value, it's pretty obvious that we meant to use a signed value
here. So let's cast the two operands to int before we subtract.
This was noticed by the following clang warning:
---8<---
../src/gallium/drivers/zink/zink_context.c:3284:14: warning: taking the
absolute value of unsigned type 'unsigned int' has no effect
[-Wabsolute-value]
last = abs(reads - writes) > UINT32_MAX / 2 ? MIN2(reads, writes) : MAX2(reads, writes);
^
---8<---
Fixes: 0c1fe392e8 ("zink: implement a tc is_resource_busy hook")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11421>
This commit is contained in:
parent
806251c72d
commit
0360533d6c
1 changed files with 1 additions and 1 deletions
|
|
@ -3283,7 +3283,7 @@ zink_context_is_resource_busy(struct pipe_screen *pscreen, struct pipe_resource
|
|||
uint32_t last;
|
||||
|
||||
if (reads && writes)
|
||||
last = abs(reads - writes) > UINT32_MAX / 2 ? MIN2(reads, writes) : MAX2(reads, writes);
|
||||
last = abs((int)reads - (int)writes) > UINT32_MAX / 2 ? MIN2(reads, writes) : MAX2(reads, writes);
|
||||
else
|
||||
last = reads ? reads : writes;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue