util/futex: replace double-cast check with a simple sign check

We want to know whether the signed int can be represented by an unsigned int
of the same size (no down-cast); for that, all we need is for it to be `>= 0`,
so let's check that.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28804>
This commit is contained in:
Eric Engestrom 2024-04-18 12:18:46 +02:00 committed by Marge Bot
parent 042b8a65d3
commit f008f6a33b
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ int futex_wait(uint32_t *addr, int32_t value, const struct timespec *timeout)
int futex_wake(uint32_t *addr, int32_t count)
{
assert(count == (int32_t)(uint32_t)count); /* Check that bits weren't discarded */
assert(count >= 0);
return _umtx_op(addr, UMTX_OP_WAKE, (uint32_t)count, NULL, NULL) == -1 ? errno : 0;
}