We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 366c0b5 commit 844bb30Copy full SHA for 844bb30
trie/ctrie/ctrie.go
@@ -494,11 +494,9 @@ func toContracted(cn *cNode, lev uint) *mainNode {
494
// toCompressed compacts the C-node as a performance optimization.
495
func toCompressed(cn *cNode, lev uint) *mainNode {
496
bmp := cn.bmp
497
- i := 0
498
arr := cn.array
499
tmpArray := make([]branch, len(arr))
500
- for i < len(arr) {
501
- sub := arr[i]
+ for i, sub := range arr {
502
switch sub.(type) {
503
case *iNode:
504
inode := sub.(*iNode)
@@ -510,7 +508,6 @@ func toCompressed(cn *cNode, lev uint) *mainNode {
510
508
default:
511
509
panic("Ctrie is in an invalid state")
512
}
513
- i++
514
515
516
return toContracted(&cNode{bmp: bmp, array: tmpArray}, lev)
0 commit comments