Skip to content

Commit 1ff4fb0

Browse files
authored
Update bits.go (#4055)
1 parent 1f2e505 commit 1ff4fb0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

util/arbmath/bits.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ func FlipBit(data bytes32, bit byte) bytes32 {
2121

2222
// ConcatByteSlices unrolls a series of slices into a singular, concatenated slice
2323
func ConcatByteSlices(slices ...[]byte) []byte {
24-
unrolled := []byte{}
24+
totalLen := 0
25+
for _, slice := range slices {
26+
totalLen += len(slice)
27+
}
28+
unrolled := make([]byte, 0, totalLen)
2529
for _, slice := range slices {
2630
unrolled = append(unrolled, slice...)
2731
}

0 commit comments

Comments
 (0)