using MaxInt constant from math

This commit is contained in:
Felix Kunde 2021-12-15 17:25:05 +01:00
parent 4f7ffe93c4
commit 8753a7665f
1 changed files with 2 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"encoding/base64" "encoding/base64"
"encoding/hex" "encoding/hex"
"fmt" "fmt"
"math"
"math/big" "math/big"
"math/rand" "math/rand"
"reflect" "reflect"
@ -332,7 +333,7 @@ func ToIntStr(val int) *intstr.IntOrString {
// Get int from IntOrString and return max int if string // Get int from IntOrString and return max int if string
func IntFromIntStr(intOrStr intstr.IntOrString) int { func IntFromIntStr(intOrStr intstr.IntOrString) int {
if intOrStr.Type == 1 { if intOrStr.Type == 1 {
return 32 << (^int(0) >> 32 & 1) // return max int return math.MaxInt
} }
return intOrStr.IntValue() return intOrStr.IntValue()
} }