accounts/abi/bind: fixed genIntType for go 1.12

This commit is contained in:
Marius van der Wijden 2020-04-03 10:13:21 +02:00
parent a95417f489
commit 4b8e707ed4

View file

@ -99,14 +99,15 @@ func makeTopics(query ...[]interface{}) ([][]common.Hash, error) {
return topics, nil
}
func genIntType(rule int64, size int) []byte {
func genIntType(rule int64, size uint) []byte {
var topic [common.HashLength]byte
if rule < 0 {
// if a rule is negative, we need to put it into two's complement.
// extended to common.Hashlength bytes.
topic = [common.HashLength]byte{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}
}
for i := 0; i < size; i++ {
var i uint
for i = 0; i < size; i++ {
topic[common.HashLength-i-1] = byte(rule >> (i * 8))
}
return topic[:]