Skip to content

Commit

Permalink
Fix a type instability in Padded (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf authored Apr 17, 2021
1 parent d4df1de commit 3d2409c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/impl/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct Padded{T, N}
pad::NTuple{N, UInt8}
end

Padded{T, N}(value::T) where {T, N} = Padded(value, zeropad(N))
Padded{T, N}(value::T) where {T, N} = Padded(value, zeropad(Val{N}()))
zeropad(N) = ntuple(_ -> UInt8(0), N)
addpadding(N::Integer, ::Type{T}) where T = Padded{T, N}
addpadding(N::Integer, value::T) where T = Padded{T, N}(value)
Expand Down

0 comments on commit 3d2409c

Please sign in to comment.