Ticket #3676: trac3676-bitset_pxd.patch

File trac3676-bitset_pxd.patch, 3.8 KB (added by rlm, 13 years ago)
  • sage/groups/perm_gps/partn_ref/tree_traversal.pxd

    # HG changeset patch
    # User Robert L. Miller <rlm@rlmiller.org>
    # Date 1217364116 25200
    # Node ID a01f7f19d0d48acdcc60511f47908653d05e7eae
    # Parent  63bfd503aaba9c0e6a4046ddb88e1566e387733a
    Split up bitset.pxi to allow use in pxd files.
    
    diff -r 63bfd503aaba -r a01f7f19d0d4 sage/groups/perm_gps/partn_ref/tree_traversal.pxd
    a b  
    88
    99include '../../../ext/cdefs.pxi'
    1010include '../../../ext/stdsage.pxi'
     11include '../../../misc/bitset_pxd.pxi'
     12
    1113from sage.rings.integer cimport Integer
    1214
    1315cdef struct OrbitPartition:
    cdef inline bint PS_is_fixed(PartitionSt 
    5052cdef inline bint PS_is_fixed(PartitionStack *, int)
    5153cdef inline int PS_clear(PartitionStack *)
    5254cdef inline int PS_split_point(PartitionStack *, int)
    53 #cdef inline int PS_first_smallest(PartitionStack *, bitset_t)
     55cdef inline int PS_first_smallest(PartitionStack *, bitset_t)
    5456cdef inline int PS_get_perm_from(PartitionStack *, PartitionStack *, int *)
    5557
    5658cdef inline int split_point_and_refine(PartitionStack *, int, object,
  • sage/misc/bitset.pxi

    diff -r 63bfd503aaba -r a01f7f19d0d4 sage/misc/bitset.pxi
    a b  
    1616
    1717
    1818# This is a .pxi file so that one can inline functions. Doctests in misc_c.
    19 
    20 include "../ext/stdsage.pxi"
    21 
    22 cdef extern from *:
    23     void *memset(void *, int, size_t)
    24     void *memcpy(void *, void *, size_t)
    25     int memcmp(void *, void *, size_t)
    26     size_t strlen(char *)
    27 
    28     # constant literals
    29     int index_shift "(sizeof(unsigned long)==8 ? 6 : 5)"
    30     unsigned long offset_mask "(sizeof(unsigned long)==8 ? 0x3F : 0x1F)"
    31    
    32 cdef struct bitset_s:
    33     long size
    34     long limbs
    35     unsigned long *bits
    36        
    37 ctypedef bitset_s bitset_t[1]
    3819
    3920#############################################################################
    4021# Bitset Initalization
  • new file sage/misc/bitset_pxd.pxi

    diff -r 63bfd503aaba -r a01f7f19d0d4 sage/misc/bitset_pxd.pxi
    - +  
     1#*****************************************************************************
     2#     Copyright (C) 2008 Robert Bradshaw <robertwb@math.washington.edu>
     3#
     4#  Distributed under the terms of the GNU General Public License (GPL)
     5#
     6#    This code is distributed in the hope that it will be useful,
     7#    but WITHOUT ANY WARRANTY; without even the implied warranty of
     8#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     9#    General Public License for more details.
     10#
     11#  The full text of the GPL is available at:
     12#
     13#                  http://www.gnu.org/licenses/
     14#*****************************************************************************
     15
     16
     17
     18# This is a .pxi file so that one can inline functions. Doctests in misc_c.
     19
     20include "../ext/stdsage.pxi"
     21
     22cdef extern from *:
     23    void *memset(void *, int, size_t)
     24    void *memcpy(void *, void *, size_t)
     25    int memcmp(void *, void *, size_t)
     26    size_t strlen(char *)
     27
     28    # constant literals
     29    int index_shift "(sizeof(unsigned long)==8 ? 6 : 5)"
     30    unsigned long offset_mask "(sizeof(unsigned long)==8 ? 0x3F : 0x1F)"
     31   
     32cdef struct bitset_s:
     33    long size
     34    long limbs
     35    unsigned long *bits
     36       
     37ctypedef bitset_s bitset_t[1]
     38
  • sage/misc/misc_c.pyx

    diff -r 63bfd503aaba -r a01f7f19d0d4 sage/misc/misc_c.pyx
    a b class NonAssociative: 
    277277# Bitset Testing
    278278#############################################################################
    279279
     280include "bitset_pxd.pxi"
    280281include "bitset.pxi"
    281282
    282283def test_bitset(py_a, py_b, long n):