mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-10-29 05:40:16 -04:00
util: convert macros to inline functions
Functionally equivalent except the usual macro footguns are avoided and type safety is increased. Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
parent
4945f2664f
commit
36cef8653f
1 changed files with 17 additions and 3 deletions
|
|
@ -174,9 +174,23 @@ union map_entry {
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define map_entry_is_free(entry) ((entry).next & 0x1)
|
static inline bool
|
||||||
#define map_entry_get_data(entry) ((void *)((entry).next & ~(uintptr_t)0x3))
|
map_entry_is_free(union map_entry entry)
|
||||||
#define map_entry_get_flags(entry) (((entry).next >> 1) & 0x1)
|
{
|
||||||
|
return entry.next & 0x1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void *
|
||||||
|
map_entry_get_data(union map_entry entry)
|
||||||
|
{
|
||||||
|
return (void *)(entry.next & ~(uintptr_t)0x3);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
map_entry_get_flags(union map_entry entry)
|
||||||
|
{
|
||||||
|
return (entry.next >> 1) & 0x1;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wl_map_init(struct wl_map *map, uint32_t side)
|
wl_map_init(struct wl_map *map, uint32_t side)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue