mirror of
https://github.com/metabarcoding/obitools4.git
synced 2025-06-29 16:20:46 +00:00

modified: pkg/obioptions/version.go modified: pkg/obitools/obitagpcr/pcrtag.go modified: pkg/obiutils/abs.go new file: pkg/obiutils/abs_test.go
15 lines
245 B
Go
15 lines
245 B
Go
package obiutils
|
|
|
|
import "golang.org/x/exp/constraints"
|
|
|
|
// Abs returns the absolute value of x.
|
|
//
|
|
// It is a generic function that can be used on any signed type.
|
|
func Abs[T constraints.Signed](x T) T {
|
|
if x < 0 {
|
|
return -x
|
|
}
|
|
|
|
return x
|
|
}
|