From ad3d61c72dc60119e3a84c035b9e9f508f1101c5 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Wed, 28 May 2014 17:39:30 -0500
Subject: [PATCH] Py2.6 doesn't have int.bit_length--use bitlog2

---
 pyopencl/mempool.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pyopencl/mempool.py b/pyopencl/mempool.py
index bd804799..8ca837d0 100644
--- a/pyopencl/mempool.py
+++ b/pyopencl/mempool.py
@@ -27,6 +27,7 @@ THE SOFTWARE.
 
 import numpy as np
 import pyopencl as cl
+from pyopencl.tools import bitlog2
 
 
 # {{{ allocators
@@ -120,7 +121,7 @@ class MemoryPool(object):
 
     @classmethod
     def bin_number(cls, size):
-        l = max(size.bit_length(), 1) - 1
+        l = bitlog2(size)
 
         mantissa_bits = cls.mantissa_bits
         if l >= mantissa_bits:
-- 
GitLab