Skip to content

Commit 369a048

Browse files
authored
Optimize overflow for DynamicContainerInfo.updateValue() (#696)
1 parent 8699396 commit 369a048

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/OpenSwiftUICore/Layout/Dynamic/DynamicContainer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ struct DynamicContainerInfo<Adapter>: StatefulRule, AsyncAttribute, ObservedAttr
440440
if removedCount == 0 {
441441
target = index
442442
} else {
443-
let i = index - info.removedCount
444-
target = i >= 0 ? i : info.items.count - (info.unusedCount + info.removedCount)
443+
let i = index &- info.removedCount
444+
target = i >= 0 ? i : info.items.count &- (info.unusedCount + info.removedCount)
445445
}
446446
}
447447
info.items[target].subgraph.index = UInt32(index)

0 commit comments

Comments
 (0)