mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-04-10 08:21:15 -04:00
connection: Use a #define for maximum buffer size power of 2
This avoids open-coding it. No functional change intended. Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
This commit is contained in:
parent
9cb3d7aa9d
commit
ce5c57ca77
1 changed files with 3 additions and 2 deletions
|
|
@ -70,12 +70,13 @@ struct wl_connection {
|
||||||
int fd;
|
int fd;
|
||||||
int want_flush;
|
int want_flush;
|
||||||
};
|
};
|
||||||
|
#define WL_BUFFER_MAX_SIZE_POT ((size_t)(8 * sizeof(size_t) - 1))
|
||||||
|
|
||||||
static inline size_t
|
static inline size_t
|
||||||
size_pot(uint32_t size_bits)
|
size_pot(uint32_t size_bits)
|
||||||
{
|
{
|
||||||
if (!(size_bits < 8 * sizeof(size_t)))
|
if (size_bits > WL_BUFFER_MAX_SIZE_POT)
|
||||||
wl_abort("Too many bits for size_t\n");
|
wl_abort("Too many bits for ring buffer\n");
|
||||||
|
|
||||||
return ((size_t)1) << size_bits;
|
return ((size_t)1) << size_bits;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue