summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mapi/glapi/gen/glX_server_table.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/mapi/glapi/gen/glX_server_table.py b/src/mapi/glapi/gen/glX_server_table.py
index 2840a4405b..14f25019f0 100644
--- a/src/mapi/glapi/gen/glX_server_table.py
+++ b/src/mapi/glapi/gen/glX_server_table.py
@@ -127,8 +127,8 @@ class FunctionTable(object):
empty_children = 0
for M in xrange(0, remaining_bits):
- op_count = 1 << (remaining_bits - M);
- child_count = 1 << M;
+ op_count = 1 << (remaining_bits - M)
+ child_count = 1 << M
empty_children = 0
full_children = 0
@@ -138,9 +138,9 @@ class FunctionTable(object):
for j in xrange(i, i + op_count):
if j in self.functions:
- used += 1;
+ used += 1
else:
- empty += 1;
+ empty += 1
if empty == op_count:
@@ -149,10 +149,11 @@ class FunctionTable(object):
if used == op_count:
full_children += 1
- if (empty_children > 0) or (full_children == child_count) or (op_count <= self.min_op_count):
+ if (empty_children > 0
+ or full_children == child_count
+ or op_count <= self.min_op_count):
break
-
# If all the remaining bits are used by this node, as is the
# case when M is 0 or remaining_bits, the node is a leaf.
@@ -190,7 +191,8 @@ class FunctionTable(object):
return True
- def __generate_table(self, node, base_opcode, remaining_bits, base_entry, depth):
+ def __generate_table(self, node, base_opcode, remaining_bits, base_entry,
+ depth):
"""Fill in self.lookup_table."""
M = node[0]
children = node[1]
@@ -207,7 +209,8 @@ class FunctionTable(object):
for child in children:
if child[1] == []:
if not self.is_empty_leaf(child_base_opcode, child_M):
- for op in xrange(child_base_opcode, child_base_opcode + (1 << child_M)):
+ for op in xrange(child_base_opcode,
+ child_base_opcode + (1 << child_M)):
if op in self.functions:
func = self.functions[op]
size = func.command_fixed_length()
@@ -244,7 +247,8 @@ class FunctionTable(object):
child_index = base_entry
for child in children:
if child[1] != []:
- self.__generate_table(child, base_opcode, remaining_bits - M, child_index, depth + 1)
+ self.__generate_table(child, base_opcode, remaining_bits - M,
+ child_index, depth + 1)
child_index += child[2]
def dump_tree(self, node, base_opcode, remaining_bits, base_entry, depth,
@@ -276,9 +280,8 @@ class FunctionTable(object):
# dispatch function lookup table.
yield 'LEAF({0}),'.format(lookup_table_len)
- # XXX: This is obviously sutpid...
- for op in xrange(child_base_opcode, child_base_opcode + (1 << child_M)):
- lookup_table_len += 1
+ lookup_table_len += (child_base_opcode + (1 << child_M) -
+ child_base_opcode)
else:
yield '{0},'.format(child_index)
child_index += child[2]