Skip to content

Commit

Permalink
Merge pull request #20456 from JuliaLang/mb/intset-refactor
Browse files Browse the repository at this point in the history
Refactor IntSets
  • Loading branch information
JeffBezanson authored Feb 7, 2017
2 parents 754757c + 651d3df commit 40831ac
Show file tree
Hide file tree
Showing 8 changed files with 461 additions and 572 deletions.
14 changes: 14 additions & 0 deletions base/bitarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,20 @@ end
return B
end

indexoffset(i) = first(i)-1
indexoffset(::Colon) = 0

@inline function setindex!(B::BitArray, x, J0::Union{Colon,UnitRange{Int}})
I0 = to_indices(B, (J0,))[1]
@boundscheck checkbounds(B, I0)
y = Bool(x)
l0 = length(I0)
l0 == 0 && return B
f0 = indexoffset(I0)+1
fill_chunks!(B.chunks, y, f0, l0)
return B
end

# logical indexing

# When indexing with a BitArray, we can operate whole chunks at a time for a ~100x gain
Expand Down
1 change: 1 addition & 0 deletions base/coreimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ end
include("reduce.jl")

## core structures
include("bitarray.jl")
include("intset.jl")
include("associative.jl")

Expand Down
4 changes: 2 additions & 2 deletions base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2586,8 +2586,8 @@ function typeinf_frame(frame)
local pc´::Int = pc + 1 # next program-counter (after executing instruction)
if pc == frame.pc´´
# need to update pc´´ to point at the new lowest instruction in W
min_pc = next(W, Int64(pc) + 1)[1]
if min_pc >= W.limit
min_pc = next(W, pc)[2]
if done(W, min_pc)
frame.pc´´ = max(min_pc, n + 1)
else
frame.pc´´ = min_pc
Expand Down
Loading

0 comments on commit 40831ac

Please sign in to comment.