mirror of https://gitlab.freedesktop.org/mesa/mesa
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:
parent
042b8a65d3
commit
f008f6a33b
|
@ -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)
|
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;
|
return _umtx_op(addr, UMTX_OP_WAKE, (uint32_t)count, NULL, NULL) == -1 ? errno : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue