Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf committed Dec 9, 2024
1 parent 8ac3719 commit 5a3454b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/RNTuple/Writing/page_writing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ function rnt_ary_to_page(ary::AbstractVector{Bool}, cr::ColumnRecord)
Page_write(reinterpret(UInt8, chunks))
end

function rnt_ary_to_page(ary::AbstractVector{T}, cr::ColumnRecord) where T<:Number
function rnt_ary_to_page(ary::AbstractVector{T}, cr::ColumnRecord) where {T<:Number}
Page_write(page_encode(ary, cr))
end

function page_encode(ary::AbstractVector{T}, cr::ColumnRecord) where T
function page_encode(ary::AbstractVector{T}, cr::ColumnRecord) where {T}
col_type = RNT_COL_TYPE_TABLE[cr.type+1]
nbits = col_type.nbits
src = reinterpret(UInt8, ary)
Expand All @@ -53,7 +53,16 @@ function page_encode(ary::AbstractVector{T}, cr::ColumnRecord) where T
end
end
function split8_encode(src::AbstractVector{UInt8})
@views [src[1:8:end-7]; src[2:8:end-6]; src[3:8:end-5]; src[4:8:end-4]; src[5:8:end-3]; src[6:8:end-2]; src[7:8:end-1]; src[8:8:end]]
@views [

Check warning on line 56 in src/RNTuple/Writing/page_writing.jl

View check run for this annotation

Codecov / codecov/patch

src/RNTuple/Writing/page_writing.jl#L56

Added line #L56 was not covered by tests
src[1:8:end-7]
src[2:8:end-6]
src[3:8:end-5]
src[4:8:end-4]
src[5:8:end-3]
src[6:8:end-2]
src[7:8:end-1]
src[8:8:end]
]
end
function split4_encode(src::AbstractVector{UInt8})
@views [src[1:4:end-3]; src[2:4:end-2]; src[3:4:end-1]; src[4:4:end]]
Expand All @@ -62,7 +71,7 @@ function split2_encode(src::AbstractVector{UInt8})
@views [src[1:2:end-1]; src[2:2:end]]
end

_to_zigzag(n) = (n << 1) (n >> (sizeof(n)*8-1))
_to_zigzag(n) = (n << 1) (n >> (sizeof(n) * 8 - 1))

Check warning on line 74 in src/RNTuple/Writing/page_writing.jl

View check run for this annotation

Codecov / codecov/patch

src/RNTuple/Writing/page_writing.jl#L74

Added line #L74 was not covered by tests
function _to_zigzag(res::AbstractVector)
out = similar(res)
@simd for i in eachindex(out, res)
Expand Down

0 comments on commit 5a3454b

Please sign in to comment.