Revert "python: Explicitly add the 'L' suffix on Python 3"
authorEric Engestrom <eric@engestrom.ch>
Sat, 8 Aug 2020 14:10:16 +0000 (16:10 +0200)
committerMarge Bot <eric+marge@anholt.net>
Sat, 14 Aug 2021 21:44:32 +0000 (21:44 +0000)
This reverts commit ad363913e6766280f53838126d67370f9e97aa12.

This code was added to be able to compare the output file while porting
the script from python2 to python3, but this has long been finished and
the extra complexity is not needed anymore.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3674>

src/compiler/nir/nir_algebraic.py

index 2a4354a..548f87b 100644 (file)
@@ -239,16 +239,7 @@ class Constant(Value):
       if isinstance(self.value, int):
          return hex(self.value)
       elif isinstance(self.value, float):
-         i = struct.unpack('Q', struct.pack('d', self.value))[0]
-         h = hex(i)
-
-         # On Python 2 this 'L' suffix is automatically added, but not on Python 3
-         # Adding it explicitly makes the generated file identical, regardless
-         # of the Python version running this script.
-         if h[-1] != 'L' and i > sys.maxsize:
-            h += 'L'
-
-         return h
+         return hex(struct.unpack('Q', struct.pack('d', self.value))[0])
       else:
          assert False