dix: HashResourceID: use unsigned integers for bit shifting

Clears warning from gcc 14.1:

../dix/resource.c: In function ‘HashResourceID’:
../dix/resource.c:691:44: warning: left shift of negative value
 [-Wshift-negative-value]
  691 |     return (id ^ (id >> numBits)) & ~((~0) << numBits);
      |                                            ^~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
This commit is contained in:
Alan Coopersmith 2024-09-08 11:59:07 -07:00
parent 39f337fd49
commit 26a7ab09ea

View File

@ -688,7 +688,7 @@ HashResourceID(XID id, unsigned int numBits)
id &= mask;
if (numBits < 9)
return (id ^ (id >> numBits) ^ (id >> (numBits<<1))) & ~((~0U) << numBits);
return (id ^ (id >> numBits)) & ~((~0) << numBits);
return (id ^ (id >> numBits)) & ~((~0U) << numBits);
}
static XID