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 committed by Enrico Weigelt, metux IT consult
parent 6a1fa5cf13
commit 2e35e40f69

View File

@ -685,7 +685,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