[Piglit] [PATCH] gl-1.0-readpixsanity: Fix Clang absolute-value warning.

Laura Ekstrand laura at jlekstrand.net
Wed Mar 4 16:11:54 PST 2015


Reviewed-by: Laura Ekstrand <laura at jlekstrand.net>

On Tue, Mar 3, 2015 at 6:26 PM, Vinson Lee <vlee at freedesktop.org> wrote:

> readpix.c:238:10: warning: using integer absolute value function 'abs'
> when argument is of floating point type [-Wabsolute-value]
>                                 dd = abs(actual - expected);
>                                      ^
> readpix.c:238:10: note: use function 'fabs' instead
>                                 dd = abs(actual - expected);
>                                      ^~~
>                                      fabs
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  tests/spec/gl-1.0/readpix.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/spec/gl-1.0/readpix.c b/tests/spec/gl-1.0/readpix.c
> index 9597706..a2822b4 100644
> --- a/tests/spec/gl-1.0/readpix.c
> +++ b/tests/spec/gl-1.0/readpix.c
> @@ -235,7 +235,7 @@ check_depth(void)
>                 for (y = 0; y < h; ++y) {
>                         for (x = 0; x < w; ++x) {
>                                 actual = buf[y*w + x]/(double)0xffffffffU;
> -                               dd = abs(actual - expected);
> +                               dd = fabs(actual - expected);
>                                 err = error_bits(dd, dbits);
>                                 if (err > current_error) {
>                                         current_error = err;
> --
> 2.3.1
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20150304/113ba07a/attachment.html>


More information about the Piglit mailing list