Skip to content

Commit be0abbb

Browse files
committed
[stdlib] _Bitset: Reduce unnecessary overflow checking
This is mostly a code size improvement.
1 parent 21da7da commit be0abbb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/public/core/Bitset.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ extension _UnsafeBitset {
6464
@inline(__always)
6565
internal static func join(word: Int, bit: Int) -> Int {
6666
_sanityCheck(bit >= 0 && bit < Word.capacity)
67-
return word &* Word.capacity + bit
67+
return word &* Word.capacity &+ bit
6868
}
6969
}
7070

7171
extension _UnsafeBitset {
7272
@inlinable
7373
@inline(__always)
7474
internal static func wordCount(forCapacity capacity: Int) -> Int {
75-
return word(for: capacity + Word.capacity - 1)
75+
return word(for: capacity &+ Word.capacity &- 1)
7676
}
7777

7878
@inlinable

0 commit comments

Comments
 (0)