* will be present in attrs.DMABufPlaneModifiersLo[0] and
* attrs.DMABufPlaneModifiersHi[0] */
if (attrs.DMABufPlaneModifiersLo[0].IsPresent) {
- modifier = (uint64_t) attrs.DMABufPlaneModifiersHi[0].Value << 32;
- modifier |= (uint64_t) (attrs.DMABufPlaneModifiersLo[0].Value & 0xffffffff);
+ modifier = combine_u32_into_u64(attrs.DMABufPlaneModifiersHi[0].Value,
+ attrs.DMABufPlaneModifiersLo[0].Value);
has_modifier = true;
}
void
dri2_fini_surface(_EGLSurface *surf);
+static inline uint64_t
+combine_u32_into_u64(uint32_t hi, uint32_t lo)
+{
+ return (((uint64_t) hi) << 32) | (((uint64_t) lo) & 0xffffffff);
+}
+
#endif /* EGL_DRI2_INCLUDED */
__DRI_IMAGE_ATTRIB_MODIFIER_LOWER,
&mod_lo);
if (query) {
- modifier = (uint64_t) mod_hi << 32;
- modifier |= (uint64_t) (mod_lo & 0xffffffff);
+ modifier = combine_u32_into_u64(mod_hi, mod_lo);
}
}
dri2_dpy->formats |= (1u << visual_idx);
mod = u_vector_add(&dri2_dpy->wl_modifiers[visual_idx]);
- *mod = (uint64_t) modifier_hi << 32;
- *mod |= (uint64_t) (modifier_lo & 0xffffffff);
+ *mod = combine_u32_into_u64(modifier_hi, modifier_lo);
}
static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {
reply = xcb_dri2_swap_buffers_reply(dri2_dpy->conn, cookie, NULL);
if (reply) {
- swap_count = (((int64_t)reply->swap_hi) << 32) | reply->swap_lo;
+ swap_count = combine_u32_into_u64(reply->swap_hi, reply->swap_lo);
free(reply);
}
}