Swich to the system min and max functions and remove the version from obiutils

Former-commit-id: 8c4558921b0d0c266b070f16e83813de6e6d4a0f
This commit is contained in:
Eric Coissac
2024-05-30 08:27:24 +02:00
parent 98b3bc2a8c
commit dd9307a4cd
12 changed files with 58 additions and 145 deletions

View File

@ -2,7 +2,6 @@ package obialign
import (
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiseq"
"git.metabarcoding.org/obitools/obitools4/obitools4/pkg/obiutils"
)
var _iupac = [26]byte{
@ -130,11 +129,11 @@ func FastLCSEGFScoreByte(bA, bB []byte, maxError int, endgapfree bool, buffer *[
// in_matrix := false
x1 := y - lB + extra
x2 := extra - y
xs := obiutils.Max(obiutils.Max(x1, x2), 0)
xs := max(x1, x2, 0)
x1 = y + extra
x2 = lA + extra - y
xf := obiutils.Min(obiutils.Min(x1, x2), even-1) + 1
xf := min(x1, x2, even-1) + 1
for x := xs; x < xf; x++ {
@ -222,11 +221,11 @@ func FastLCSEGFScoreByte(bA, bB []byte, maxError int, endgapfree bool, buffer *[
// . 9 10 + 2 - 1
x1 = y - lB + extra + even
x2 = extra - y + even - 1
xs = obiutils.Max(obiutils.Max(x1, x2), even)
xs = max(x1, x2, even)
x1 = y + extra + even
x2 = lA + extra - y + even - 1
xf = obiutils.Min(obiutils.Min(x1, x2), width-1) + 1
xf = min(x1, x2, width-1) + 1
for x := xs; x < xf; x++ {
@ -383,4 +382,3 @@ func FastLCSEGFScore(seqA, seqB *obiseq.BioSequence, maxError int, buffer *[]uin
func FastLCSScore(seqA, seqB *obiseq.BioSequence, maxError int, buffer *[]uint64) (int, int) {
return FastLCSEGFScoreByte(seqA.Sequence(), seqB.Sequence(), maxError, false, buffer)
}