diff --git a/zipline/lib/_factorize.pyx b/zipline/lib/_factorize.pyx index 88e6c2e1..390266ed 100644 --- a/zipline/lib/_factorize.pyx +++ b/zipline/lib/_factorize.pyx @@ -1,7 +1,7 @@ """ Factorization algorithms. """ -from libc.math cimport log2, floor +from libc.math cimport floor cimport numpy as np import numpy as np @@ -10,6 +10,16 @@ from zipline.utils.numpy_utils import unsigned_int_dtype_with_size_in_bytes np.import_array() +IF UNAME_SYSNAME == "Windows": + # msvc doesn't define log2 + from libc.math cimport log + + cdef double log2(double d): + return log(d) / log(2); +ELSE: + from libc.math cimport log2 + + ctypedef fused unsigned_integral: np.uint8_t np.uint16_t