Files
traces/pkg/util/math/math.go
Martin DisibioandGitHub 6e2acc4bfc Fix a few bugs in vParquet2 structural operators (#2660)
* Fix vparquet2 structural operators to skip spans with broken nested set data

* Fix bug in sibling where it falsely identified same span as its sibling

* changelog

* lint
2023-07-14 16:26:05 -04:00

54 lines
758 B
Go

package math
// Max returns the maximum of two ints
func Max(a, b int) int {
if a > b {
return a
}
return b
}
// Min returns the minimum of two ints
func Min(a, b int) int {
if a < b {
return a
}
return b
}
// Max64 returns the maximum uint64s
func Max64(values ...uint64) uint64 {
if len(values) == 0 {
return 0
}
if len(values) == 1 {
return values[0]
}
x := values[0]
for i := 1; i < len(values); i++ {
if values[i] > x {
x = values[i]
}
}
return x
}
// Min64 returns the minimum of uint64s
func Min64(values ...uint64) uint64 {
if len(values) == 0 {
return 0
}
if len(values) == 1 {
return values[0]
}
x := values[0]
for i := 1; i < len(values); i++ {
if values[i] < x {
x = values[i]
}
}
return x
}