commit: 0027cf6d4b6110dbaf5876ee0e891342fae3c984 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Wed Sep 6 13:44:17 2017 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Wed Sep 6 13:44:46 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0027cf6d
eapi7-ver.eclass: Use the power of maths to simplify splitting eclass/eapi7-ver.eclass | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass index 70a1b3e9847..27571bc0d03 100644 --- a/eclass/eapi7-ver.eclass +++ b/eclass/eapi7-ver.eclass @@ -51,7 +51,7 @@ _version_split() { } version_cut() { - local start end istart iend + local start end istart local -a comp _version_parse_range "$1" @@ -59,14 +59,12 @@ version_cut() { local IFS= if [[ ${start} -gt 0 ]]; then - istart=$(( (start-1)*2 + 1 )) - iend=$(( (end-start)*2 + 1 )) + istart=$(( start*2 - 1 )) else istart=0 - iend=$(( (end-start)*2 )) fi if [[ ${end} ]]; then - echo "${comp[*]:istart:iend}" + echo "${comp[*]:istart:end*2-istart}" else echo "${comp[*]:istart}" fi