From 7e01d504c7fe5df2c1c8a2eab5518280f778e8f5 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 30 Mar 2016 16:28:12 -0700 Subject: glapi: glX_server_table.py: use math.log instead of hand coded log2 function This just saves a bit of typing. Signed-off-by: Dylan Baker --- src/mapi/glapi/gen/glX_server_table.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/mapi/glapi/gen/glX_server_table.py b/src/mapi/glapi/gen/glX_server_table.py index 4549fbd219..a4bc04f936 100644 --- a/src/mapi/glapi/gen/glX_server_table.py +++ b/src/mapi/glapi/gen/glX_server_table.py @@ -27,6 +27,7 @@ # Ian Romanick import argparse +import math import glX_XML import glX_proto_common @@ -34,15 +35,6 @@ import gl_XML import license -def log2(value): - for i in xrange(30): - p = 1 << i - if p >= value: - return i - - return -1 - - def round_down_to_power_of_two(n): """Returns the nearest power-of-two less than or equal to n.""" @@ -77,7 +69,7 @@ class function_table: self.max_opcode = opcode if opcode > self.next_opcode_threshold: - bits = log2(opcode) + bits = int(math.log(opcode, 2)) if (1 << bits) <= opcode: bits += 1 -- cgit v1.2.3