[Mesa-dev] [PATCH 38/41] glapi: glX_proto_size.py: Remove dead code.

Dylan Baker baker.dylan.c at gmail.com
Fri Apr 1 00:04:55 UTC 2016


This code has for a long time returned 0 on entry. This makes the code
dead, and the one place it is invoked a no-op if statement (it will
always go down the if path).

Thanks to version control it's rather simple to restore it if someday
someone decides that they want it.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 src/mapi/glapi/gen/glX_proto_size.py | 77 +-----------------------------------
 1 file changed, 1 insertion(+), 76 deletions(-)

diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py
index b8625a6..e4d685b 100644
--- a/src/mapi/glapi/gen/glX_proto_size.py
+++ b/src/mapi/glapi/gen/glX_proto_size.py
@@ -104,80 +104,6 @@ class glx_enum_function(object):
     def is_set(self):
         return self.mode
 
-    def PrintUsingTable(self):
-        """Emit the body of the __gl*_size function using a pair
-        of look-up tables and a mask.  The mask is calculated such
-        that (e & mask) is unique for all the valid values of e for
-        this function.  The result of (e & mask) is used as an index
-        into the first look-up table.  If it matches e, then the
-        same entry of the second table is returned.  Otherwise zero
-        is returned.
-
-        It seems like this should cause better code to be generated.
-        However, on x86 at least, the resulting .o file is about 20%
-        larger then the switch-statment version.  I am leaving this
-        code in because the results may be different on other
-        platforms (e.g., PowerPC or x86-64)."""
-
-        return 0
-        count = 0
-        for a in self.enums:
-            count += 1
-
-        if -1 in self.count:
-            return 0
-
-        # Determine if there is some mask M, such that M = (2^N) - 1,
-        # that will generate unique values for all of the enums.
-
-        mask = 0
-        for i in [1, 2, 3, 4, 5, 6, 7, 8]:
-            mask = (1 << i) - 1
-
-            fail = 0
-            for a in self.enums:
-                for b in self.enums:
-                    if a != b:
-                        if (a & mask) == (b & mask):
-                            fail = 1
-
-            if not fail:
-                break
-            else:
-                mask = 0
-
-        if (mask != 0) and (mask < (2 * count)):
-            masked_enums = {}
-            masked_count = {}
-
-            for i in xrange(mask + 1):
-                masked_enums[i] = "0"
-                masked_count[i] = 0
-
-            for c in self.count:
-                for e in self.count[c]:
-                    i = e & mask
-                    enum_obj = self.enums[e][0]
-                    masked_enums[i] = '0x%04x /* %s */' % (e, enum_obj.name)
-                    masked_count[i] = c
-
-            print '    static const GLushort a[%u] = {' % (mask + 1)
-            for e in masked_enums:
-                print '        %s, ' % (masked_enums[e])
-            print '    };'
-
-            print '    static const GLubyte b[%u] = {' % (mask + 1)
-            for c in masked_count:
-                print '        %u, ' % (masked_count[c])
-            print '    };'
-
-            print '    const unsigned idx = (e & 0x%02xU);' % (mask)
-            print ''
-            print '    return (e == a[idx]) ? (GLint) b[idx] : 0;'
-            return True
-        else:
-            return False
-
     def PrintUsingSwitch(self, name):
         """Emit the body of the __gl*_size function using a switch-statement."""
 
@@ -221,8 +147,7 @@ class glx_enum_function(object):
         print '__gl%s_size( GLenum e )' % (name)
         print '{'
 
-        if not self.PrintUsingTable():
-            self.PrintUsingSwitch(name)
+        self.PrintUsingSwitch(name)
 
         print '}'
         print ''
-- 
2.8.0



More information about the mesa-dev mailing list