Skip to content

Commit 1c878f2

Browse files
committed
refactor: propagate inbounds to unpacking and packing
1 parent 6e3db19 commit 1c878f2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ValueInterface.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ get_number_type(::Type{T}) where {T<:Number} = T
1717
Fill all constants stored in your `value` to `nvals`, starting from `idx`.
1818
Return the index for the next `pack_scalar_constants!` to use
1919
"""
20-
function pack_scalar_constants!(nvals::AbstractVector{<:Number}, idx::Int64, value::Number)
20+
Base.@propagate_inbounds function pack_scalar_constants!(
21+
nvals::AbstractVector{<:Number}, idx::Int64, value::Number
22+
)
2123
nvals[idx] = value
2224
return idx + 1
2325
end
@@ -33,7 +35,7 @@ Returns a tuple of the next index to read from, and the filled-in value.
3335
!!! note
3436
In the case of a `Number` `value`, this will simply increment the index by 1 and return the current value.
3537
"""
36-
function unpack_scalar_constants(
38+
Base.@propagate_inbounds function unpack_scalar_constants(
3739
nvals::AbstractVector{<:Number}, idx::Int64, value::T
3840
) where {T}
3941
return (idx + 1, convert(T, nvals[idx]))

0 commit comments

Comments
 (0)