Skip to content

Commit 6333ece

Browse files
author
gohumble
committed
mint: simplify AmountSplit by iterating over amount bits (#44)
1 parent 5a7f52a commit 6333ece

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mint/mint.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import (
55
"encoding/hex"
66
"fmt"
77
"math"
8-
"math/bits"
8+
"math/bits"
99
"reflect"
10-
"strconv"
1110
"strings"
1211

1312
"github.com/btcsuite/btcd/btcutil"
@@ -430,7 +429,7 @@ func AmountSplit(amount uint64) []uint64 {
430429
rv := make([]uint64, 0)
431430
for i := 0; i < bits.Len64(amount); i++ {
432431
if (amount & (1 << i)) != 0 { // if bit i is set, add 2**i to list
433-
rv = append(rv, 1 << i)
432+
rv = append(rv, 1<<i)
434433
}
435434
}
436435
return rv

0 commit comments

Comments
 (0)