Skip to content

Commit

Permalink
small performance improvment (1%)
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tron committed Oct 20, 2018
1 parent e215a00 commit 89529c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base58.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ func FastBase58EncodingAlphabet(bin []byte, alphabet *Alphabet) string {
}

size := (binsz-zcount)*138/100 + 1
var buf = make([]byte, size)
var buf = make([]uint32, size)

high = size - 1
for i = zcount; i < binsz; i++ {
j = size - 1
for carry = uint32(bin[i]); j > high || carry != 0; j-- {
carry = carry + 256*uint32(buf[j])
buf[j] = byte(carry % 58)
carry += buf[j] << 8
buf[j] = carry % 58
carry /= 58
}
high = j
Expand Down

0 comments on commit 89529c6

Please sign in to comment.