mirror of
https://github.com/metabarcoding/obitools4.git
synced 2026-11-10 01:24:41 +00:00
Changes to be committed:
modified: pkg/obioptions/version.go modified: pkg/obitools/obitagpcr/pcrtag.go modified: pkg/obiutils/abs.go new file: pkg/obiutils/abs_test.go
This commit is contained in:
1 parent
3e00d39d47
commit
fefc360f80
4 files changed
+102
-40
No files matched your search
@@ -2,9 +2,13 @@ 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
|
||||
}
|
||||
Reference in new issue
Block a user