~ubuntu-branches/ubuntu/wily/julia/wily

« back to all changes in this revision

Viewing changes to base/intset.jl

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot
  • Date: 2013-02-11 03:51:26 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130211035126-hap464pbhd97wjbl
Tags: 0.1~20130211.git86fbe98d-1
* New upstream snapshot.
* debian/control:
   + add git to Recommends (for Julia package manager)
   + remove dependencies on libglpk-dev (it moved to its own package)
   + add explicit dependency on libgmp10 (there is no more a wrapper)
* fix-clean-rules.patch: remove patch, applied upstream
* gsvddense_blasint.patch: new patch
* Refresh other patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 
13
13
copy(s::IntSet) = union!(IntSet(), s)
14
14
 
15
 
function resize(s::IntSet, top::Integer)
 
15
function sizehint(s::IntSet, top::Integer)
16
16
    if top >= s.limit
17
17
        lim = ((top+31) & -32)>>>5
18
18
        olsz = length(s.bits)
19
19
        if olsz < lim
20
 
            grow!(s.bits, lim-olsz)
 
20
            resize!(s.bits, lim)
21
21
            fill = s.fill1s ? uint32(-1) : uint32(0)
22
22
            for i=(olsz+1):lim; s.bits[i] = fill; end
23
23
        end
32
32
            return s
33
33
        else
34
34
            lim = int(n + div(n,2))
35
 
            resize(s, lim)
 
35
            sizehint(s, lim)
36
36
        end
37
37
    end
38
38
    s.bits[n>>5 + 1] |= (uint32(1)<<(n&31))
50
50
    if n >= s.limit
51
51
        if s.fill1s
52
52
            lim = int(n + div(n,2))
53
 
            resize(s, lim)
 
53
            sizehint(s, lim)
54
54
        else
55
55
            return deflt
56
56
        end
88
88
function symdiff!(s::IntSet, n::Integer)
89
89
    if n >= s.limit
90
90
        lim = int(n + dim(n,2))
91
 
        resize(s, lim)
 
91
        sizehint(s, lim)
92
92
    end
93
93
    s.bits[n>>5 + 1] $= (uint32(1)<<(n&31))
94
94
    return s
165
165
# Math functions
166
166
function union!(s::IntSet, s2::IntSet)
167
167
    if s2.limit > s.limit
168
 
        resize(s, s2.limit)
 
168
        sizehint(s, s2.limit)
169
169
    end
170
170
    lim = length(s2.bits)
171
171
    for n = 1:lim
186
186
 
187
187
function intersect!(s::IntSet, s2::IntSet)
188
188
    if s2.limit > s.limit
189
 
        resize(s, s2.limit)
 
189
        sizehint(s, s2.limit)
190
190
    end
191
191
    lim = length(s2.bits)
192
192
    for n = 1:lim
215
215
 
216
216
function symdiff!(s::IntSet, s2::IntSet)
217
217
    if s2.limit > s.limit
218
 
        resize(s, s2.limit)
 
218
        sizehint(s, s2.limit)
219
219
    end
220
220
    lim = length(s2.bits)
221
221
    for n = 1:lim