From c18952c6a63c10b8b0ca9d476da9f2d09f424390 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Sun, 4 Jan 2015 20:32:46 -0600 Subject: [PATCH] Switch _div64, _mod64 for julia 0.4 changes Fixes #135 --- src/indexing.jl | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/indexing.jl b/src/indexing.jl index b9d7589..626d0c8 100644 --- a/src/indexing.jl +++ b/src/indexing.jl @@ -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)