Skip to content

Commit fb84346

Browse files
committed
fix "Incorrect conversion between integer types"
1 parent 50019cf commit fb84346

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

common.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"crypto/rand"
99
"encoding/binary"
1010
"encoding/hex"
11+
"math"
1112
"net"
1213
"os"
1314
"reflect"
@@ -163,8 +164,9 @@ func ConvertToBytes(humanReadableString string) int {
163164
}
164165
}
165166

166-
if size > float64(^uint(0)>>1) {
167-
return int(^uint(0) >> 1)
167+
if size > float64(math.MaxInt) {
168+
return math.MaxInt
168169
}
170+
169171
return int(size)
170172
}

0 commit comments

Comments
 (0)