diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2016-03-30 16:28:12 -0700 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2016-03-31 16:03:59 -0700 |
commit | 7e01d504c7fe5df2c1c8a2eab5518280f778e8f5 (patch) | |
tree | 6b7705ae1e5f0c8837a871db71ec18dc1867201a | |
parent | 7a3c4eac85b89df1a62347f4eddb1d1a57fa2b40 (diff) |
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 <dylanx.c.baker@intel.com>
-rw-r--r-- | src/mapi/glapi/gen/glX_server_table.py | 12 |
1 files 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 <idr@us.ibm.com> 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 |