mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Very minor refactor of the integer overflow fix
Signed-off-by: Jeanette Tan <jeanette.tan@grafana.com>
This commit is contained in:
parent
ef8e6ae780
commit
71a36d2396
|
@ -178,42 +178,36 @@ type chunkMetaAndChunkDiskMapperRef struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func refLessByMinTimeAndMinRef(a, b chunkMetaAndChunkDiskMapperRef) int {
|
func refLessByMinTimeAndMinRef(a, b chunkMetaAndChunkDiskMapperRef) int {
|
||||||
if a.meta.MinTime == b.meta.MinTime {
|
|
||||||
switch {
|
|
||||||
case a.meta.Ref < b.meta.Ref:
|
|
||||||
return -1
|
|
||||||
case a.meta.Ref > b.meta.Ref:
|
|
||||||
return 1
|
|
||||||
default:
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch {
|
switch {
|
||||||
case a.meta.MinTime < b.meta.MinTime:
|
case a.meta.MinTime < b.meta.MinTime:
|
||||||
return -1
|
return -1
|
||||||
case a.meta.MinTime > b.meta.MinTime:
|
case a.meta.MinTime > b.meta.MinTime:
|
||||||
return 1
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case a.meta.Ref < b.meta.Ref:
|
||||||
|
return -1
|
||||||
|
case a.meta.Ref > b.meta.Ref:
|
||||||
|
return 1
|
||||||
default:
|
default:
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func lessByMinTimeAndMinRef(a, b chunks.Meta) int {
|
func lessByMinTimeAndMinRef(a, b chunks.Meta) int {
|
||||||
if a.MinTime == b.MinTime {
|
|
||||||
switch {
|
|
||||||
case a.Ref < b.Ref:
|
|
||||||
return -1
|
|
||||||
case a.Ref > b.Ref:
|
|
||||||
return 1
|
|
||||||
default:
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch {
|
switch {
|
||||||
case a.MinTime < b.MinTime:
|
case a.MinTime < b.MinTime:
|
||||||
return -1
|
return -1
|
||||||
case a.MinTime > b.MinTime:
|
case a.MinTime > b.MinTime:
|
||||||
return 1
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case a.Ref < b.Ref:
|
||||||
|
return -1
|
||||||
|
case a.Ref > b.Ref:
|
||||||
|
return 1
|
||||||
default:
|
default:
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue