summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2016-03-31 14:01:56 -0700
committerDylan Baker <baker.dylan.c@gmail.com>2016-03-31 16:03:59 -0700
commit7a3c4eac85b89df1a62347f4eddb1d1a57fa2b40 (patch)
treefb9a56b8a0ac27186f606c4e13adc312d4892e2a
parent1126121d42d5e2e43bc0bf7227e68a02283af029 (diff)
glapi: glX_proto_size.py: Remove dead code.
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@intel.com>
-rw-r--r--src/mapi/glapi/gen/glX_proto_size.py77
1 files changed, 1 insertions, 76 deletions
diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py
index b8625a65f5..e4d685b63d 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 ''