Re: [spice-gtk v1 3/3] Fix clang's double-promotion warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> From: Victor Toso <me@xxxxxxxxxxxxxx>
> 
> Casting to gdouble instead to float to avoid the warning and perhaps
> increase the precision.
> 
> spice-widget-egl.c:573:28: error: implicit conversion increases
> floating-point precision: 'float' to 'gdouble' (aka 'double')
>     tx = ((float)d->area.x / (float)d->egl.scanout.width);
>        ~  ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> spice-widget-egl.c:574:28: error: implicit conversion increases
> floating-point precision: 'float' to 'gdouble' (aka 'double')
>     ty = ((float)d->area.y / (float)d->egl.scanout.height);
>        ~  ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> spice-widget-egl.c:575:32: error: implicit conversion increases
> floating-point precision: 'float' to 'gdouble' (aka 'double')
>     tw = ((float)d->area.width / (float)d->egl.scanout.width);
>        ~  ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> spice-widget-egl.c:576:33: error: implicit conversion increases
> floating-point precision: 'float' to 'gdouble' (aka 'double')
>     th = ((float)d->area.height / (float)d->egl.scanout.height);
>        ~  ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
> ---
>  src/spice-widget-egl.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index 1e71753..5354e26 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -570,10 +570,10 @@ void spice_egl_update_display(SpiceDisplay *display)
>      glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
>      glClear(GL_COLOR_BUFFER_BIT);
>  
> -    tx = ((float)d->area.x / (float)d->egl.scanout.width);
> -    ty = ((float)d->area.y / (float)d->egl.scanout.height);
> -    tw = ((float)d->area.width / (float)d->egl.scanout.width);
> -    th = ((float)d->area.height / (float)d->egl.scanout.height);
> +    tx = (gdouble) d->area.x / d->egl.scanout.width;
> +    ty = (gdouble) d->area.y / d->egl.scanout.height;
> +    tw = (gdouble) d->area.width / d->egl.scanout.width;
> +    th = (gdouble) d->area.height / d->egl.scanout.height;
>  
>      /* convert to opengl coordinates, 0 is bottom, 1 is top. ty should
>       * be the bottom of the area, since th is upward */

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]