[Mesa-dev] [PATCH mesa] egl/wayland: upcast before bitwise ops

Emil Velikov emil.l.velikov at gmail.com
Thu Aug 16 15:12:50 UTC 2018


On 16 August 2018 at 15:23, Eric Engestrom <eric.engestrom at intel.com> wrote:
> Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
> ---
>  src/egl/drivers/dri2/platform_wayland.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> index 0913394b365255f6af63..f1680495210987d57ba6 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -818,8 +818,8 @@ create_wl_buffer(struct dri2_egl_display *dri2_dpy,
>                                             __DRI_IMAGE_ATTRIB_MODIFIER_LOWER,
>                                             &mod_lo);
>        if (query) {
> -         modifier = (uint64_t) mod_hi << 32;
> -         modifier |= (uint64_t) (mod_lo & 0xffffffff);
> +         modifier = ((uint64_t) mod_hi) << 32;
> +         modifier |= ((uint64_t) mod_lo) & 0xffffffff;
>        }
>     }
>
> @@ -1192,8 +1192,8 @@ dmabuf_handle_modifier(void *data, struct zwp_linux_dmabuf_v1 *dmabuf,
>     dri2_dpy->formats |= (1 << 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 = ((uint64_t) modifier_hi) << 32u;
> +   *mod |= ((uint64_t) modifier_lo) & 0xffffffff;
>  }
>
Since we're bound to make the same mistake again, can we make this an
inline helper in egl_dri2.h and reuse it in here + egl_dri2.c

Thanks
Emil


More information about the mesa-dev mailing list