Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #136 from timholy/pull-request/c18952c6
Browse files Browse the repository at this point in the history
Switch _div64, _mod64 for julia 0.4 changes
  • Loading branch information
simonster committed Jan 5, 2015
2 parents 5133b85 + c18952c commit 359b9f3
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,21 @@ unsafe_getindex_notna(pda::PooledDataArray, extr, idx::Real) = getindex(extr[2],
unsafe_getindex_notna(a, extr, idx::Real) = Base.unsafe_getindex(a, idx)

# Set NA or data portion of DataArray
unsafe_bitsettrue!(chunks::Vector{Uint64}, idx::Real) =
chunks[Base.@_div64(int(idx)-1)+1] |= (uint64(1) << Base.@_mod64(int(idx)-1))
unsafe_bitsetfalse!(chunks::Vector{Uint64}, idx::Real) =
chunks[Base.@_div64(int(idx)-1)+1] &= ~(uint64(1) << Base.@_mod64(int(idx)-1))

if VERSION < v"0.4.0-dev+2456"
eval(quote
unsafe_bitsettrue!(chunks::Vector{Uint64}, idx::Real) =
chunks[Base.@_div64(int(idx)-1)+1] |= (uint64(1) << Base.@_mod64(int(idx)-1))
unsafe_bitsetfalse!(chunks::Vector{Uint64}, idx::Real) =
chunks[Base.@_div64(int(idx)-1)+1] &= ~(uint64(1) << Base.@_mod64(int(idx)-1))
end)
else
unsafe_bitsettrue!(chunks::Vector{Uint64}, idx::Real) =
chunks[Base._div64(int(idx)-1)+1] |= (uint64(1) << Base._mod64(int(idx)-1))
unsafe_bitsetfalse!(chunks::Vector{Uint64}, idx::Real) =
chunks[Base._div64(int(idx)-1)+1] &= ~(uint64(1) << Base._mod64(int(idx)-1))
end

unsafe_setna!(da::DataArray, extr, idx::Real) = unsafe_bitsettrue!(extr[2], idx)
unsafe_setna!(da::PooledDataArray, extr, idx::Real) = setindex!(extr[1], 0, idx)
unsafe_setnotna!(da::DataArray, extr, idx::Real) = unsafe_bitsetfalse!(extr[2], idx)
Expand Down

0 comments on commit 359b9f3

Please sign in to comment.