This seems perfectly fine to me. For what it's worth: Reviewed-by: Dylan Baker <baker.dyla...@gmail.com>
Quoting Matt Turner (2016-02-04 17:48:00) > The next patch adds an algebraic rule that uses the constant 0xff00ff00. > > Without this change, the build fails with > > return hex(struct.unpack('I', struct.pack('i', self.value))[0]) > struct.error: 'i' format requires -2147483648 <= number <= 2147483647 > > The hex() function handles integers of any size, and assigning a > negative value to an unsigned does what we want in C. The pack/unpack is > unnecessary (and as we see, buggy). > --- > src/compiler/nir/nir_algebraic.py | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/src/compiler/nir/nir_algebraic.py > b/src/compiler/nir/nir_algebraic.py > index 77ad35e..2357b57 100644 > --- a/src/compiler/nir/nir_algebraic.py > +++ b/src/compiler/nir/nir_algebraic.py > @@ -102,13 +102,10 @@ class Constant(Value): > self.value = val > > def __hex__(self): > - # Even if it's an integer, we still need to unpack as an unsigned > - # int. This is because, without C99, we can only assign to the first > - # element of a union in an initializer. > if isinstance(self.value, (bool)): > return 'NIR_TRUE' if self.value else 'NIR_FALSE' > if isinstance(self.value, (int, long)): > - return hex(struct.unpack('I', struct.pack('i', self.value))[0]) > + return hex(self.value) > elif isinstance(self.value, float): > return hex(struct.unpack('I', struct.pack('f', self.value))[0]) > else: > -- > 2.4.10 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
signature.asc
Description: signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev