mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-29 11:15:50 +00:00
begin int64 to uint64 migration
This commit is contained in:
@@ -7,6 +7,13 @@ func MaxInt64(a, b int64) int64 {
|
||||
return b
|
||||
}
|
||||
|
||||
func MaxUint64(a, b uint64) uint64 {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func MaxInt(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
@@ -23,6 +30,13 @@ func MinInt64(a, b int64) int64 {
|
||||
return b
|
||||
}
|
||||
|
||||
func MinUint64(a, b uint64) uint64 {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func MinInt(a, b int) int {
|
||||
if a < b {
|
||||
return a
|
||||
|
||||
@@ -33,11 +33,9 @@ func SafeSubInt32(a, b int32) int32 {
|
||||
|
||||
// SafeConvertInt32 takes a int and checks if it overflows
|
||||
// If there is an overflow this will panic
|
||||
func SafeConvertInt32(a int64) int32 {
|
||||
func SafeConvertInt32(a uint64) int32 {
|
||||
if a > math.MaxInt32 {
|
||||
panic(ErrOverflowInt32)
|
||||
} else if a < math.MinInt32 {
|
||||
panic(ErrOverflowInt32)
|
||||
}
|
||||
return int32(a)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user