Commit c7311654 authored by Olivier Fourdan's avatar Olivier Fourdan 🛠 Committed by Adam Jackson
Browse files

dix: cache ResourceClientBits() value

The `LimitClient` is set once and for all at startup, whereas the
function `ResourceClientBits()` which returns the client field offset
within the XID based on the value of `LimitClient` can be called

Small optimization, cache the result of `ilog2()`, that saves running
the same loop over and over each time `ResourceClientBits()` is called.
Signed-off-by: Olivier Fourdan's avatarOlivier Fourdan <>
parent 48b1af27
Pipeline #11874 passed with stage
in 1 minute and 7 seconds
......@@ -620,7 +620,12 @@ ilog2(int val)
unsigned int
return (ilog2(LimitClients));
static unsigned int cached = 0;
if (cached == 0)
cached = ilog2(LimitClients);
return cached;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment