diff --git a/src/sage/data_structures/binary_matrix.pxd b/src/sage/data_structures/binary_matrix.pxd index 9856322d030..1ad33b94c7f 100644 --- a/src/sage/data_structures/binary_matrix.pxd +++ b/src/sage/data_structures/binary_matrix.pxd @@ -1,26 +1,8 @@ -include 'sage/ext/stdsage.pxi' -include 'sage/ext/cdefs.pxi' - from sage.data_structures.bitset cimport bitset_t -cdef extern from *: - int __builtin_popcountl(unsigned long) - void *memset(void *, int, size_t) - -# Constants from bitset.pxd -cdef extern from *: - int index_shift "(sizeof(unsigned long)==8 ? 6 : 5)" - unsigned long offset_mask "(sizeof(unsigned long)==8 ? 0x3F : 0x1F)" - - cdef struct binary_matrix_s: long n_cols long n_rows - - # Number of "unsigned long" per row - long width - - bitset_t * rows + bitset_t* rows ctypedef binary_matrix_s[1] binary_matrix_t - diff --git a/src/sage/data_structures/binary_matrix.pxi b/src/sage/data_structures/binary_matrix.pxi index a9895ca90c0..85ab019bfb5 100644 --- a/src/sage/data_structures/binary_matrix.pxi +++ b/src/sage/data_structures/binary_matrix.pxi @@ -17,9 +17,11 @@ a ``binary_matrix_t`` structure contains : containing the bits of row `i`. """ + from sage.data_structures.binary_matrix cimport * include 'sage/data_structures/bitset.pxi' + cdef inline binary_matrix_init(binary_matrix_t m, long n_rows, long n_cols): r""" Allocates the binary matrix. @@ -28,7 +30,6 @@ cdef inline binary_matrix_init(binary_matrix_t m, long n_rows, long n_cols): m.n_cols = n_cols m.n_rows = n_rows - m.width = (n_cols - 1)/(8*sizeof(unsigned long)) + 1 m.rows = sage_malloc(n_rows * sizeof(bitset_t)) if m.rows == NULL: raise MemoryError @@ -101,10 +102,6 @@ cdef inline binary_matrix_print(binary_matrix_t m): cdef int i,j import sys for i from 0 <= i < m.n_rows: - # If you want to print the *whole* matrix, including the useless bits, - # use the following line instead - # - # for j in (m.width*8*sizeof(unsigned long)): for j from 0 <= j < m.n_cols: sys.stdout.write("1" if binary_matrix_get(m, i, j) else ".",) print ""