[Mesa-dev] [PATCH v2 0/6] Various fixes to integer GetUniform*()

Iago Toral itoral at igalia.com
Mon May 22 09:40:21 UTC 2017


On Sat, 2017-05-20 at 14:09 -0700, Matt Turner wrote:
> On Thu, May 18, 2017 at 2:43 AM, Iago Toral Quiroga <itoral at igalia.co
> m> wrote:
> > The main change is that we now use round*() instead of IROUND*()
> > which only
> > worked for signed integer cases. I have also made it so we write
> > converted unsigned values the unsigned field in the destination
> > union and to
> > cast the result from round*() to the target integer type explicitly
> > (this is
> > redundant now that we we write to the appropriate union field, but
> > shouldn't
> > hurt).
> > 
> > The series drops the patch that added IROUNDD64 since we no longer
> > need
> > that macro and adds another patch at the end to remove the
> > remaining uses
> > of IROUND macros in this function (still used for signed integer
> > cases) for
> > the sake of consistency.
> 
> Thank you for doing this.
> 
> Assuming my suggestions to use lround/llround/etc don't cause
> problems, the series is

Since these functions return a signed integer in all cases, we have the
same problems that Nicolai discussed for the IROUND() functions: they
won't do the right thing when the floating point value exceeds the
signed integer range:

#include <stdio.h>
#include <math.h>

int main()
{
     double f = 10000000000000000000.0;
     printf("%llu %llu\n", llround(f), (unsigned long long int)f);
}

./a.out 
9223372036854775808 10000000000000000000

> Reviewed-by: Matt Turner <mattst88 at gmail.com>

Does your review-by still stand for the original version?

Iago


More information about the mesa-dev mailing list