From 0fb84a9c61ade7f305f53d042eadd46418977fdd Mon Sep 17 00:00:00 2001 From: Marek Kaluba Date: Mon, 24 May 2021 01:40:54 +0200 Subject: [PATCH] add a few @inbounds --- src/new_autgroups.jl | 2 +- src/new_transvections.jl | 2 +- src/new_types.jl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/new_autgroups.jl b/src/new_autgroups.jl index 905080e..e0b2caf 100644 --- a/src/new_autgroups.jl +++ b/src/new_autgroups.jl @@ -106,7 +106,7 @@ function evaluate!( ) where {T<:FPGroupElement,N} A = alphabet(f) for idx in word(f) - t = evaluate!(t, A[idx], alphabet(object(parent(f))))::NTuple{N,T} + t = @inbounds evaluate!(t, A[idx], alphabet(object(parent(f))))::NTuple{N,T} end return t end diff --git a/src/new_transvections.jl b/src/new_transvections.jl index a4cdfe6..2200b93 100644 --- a/src/new_transvections.jl +++ b/src/new_transvections.jl @@ -49,7 +49,7 @@ Base.:(==)(t::Transvection, s::Transvection) = t.id === s.id && t.ij == s.ij && t.inv == s.inv Base.hash(t::Transvection, h::UInt) = hash(t.id, hash(t.ij, hash(t.inv, h))) -function evaluate!(v::Tuple, t::Transvection, A::Alphabet) +Base.@propagate_inbounds function evaluate!(v::Tuple, t::Transvection, A::Alphabet) i, j = indices(t) @assert i ≤ length(v) && j ≤ length(v) diff --git a/src/new_types.jl b/src/new_types.jl index d98d38c..69e3526 100644 --- a/src/new_types.jl +++ b/src/new_types.jl @@ -32,7 +32,7 @@ word_type(::Type{<:AbstractFPGroup}) = Word{UInt8} # the default (results in free rewriting) rewriting(G::AbstractFPGroup) = alphabet(G) -function (G::AbstractFPGroup)(word::AbstractVector{<:Integer}) +Base.@propagate_inbounds function (G::AbstractFPGroup)(word::AbstractVector{<:Integer}) @boundscheck @assert all(l -> 1 <= l <= length(KnuthBendix.alphabet(G)), word) return FPGroupElement(word_type(G)(word), G) end