Skip to content

Commit 267b80f

Browse files
committed
[stdlib] _Bitset: Use &* for join and capacity
We know it won’t overflow, because the result will not exceed the capacity, which is guaranteed to fit in an integer.
1 parent 18c5654 commit 267b80f

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,7 +64,7 @@ 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

@@ -79,7 +79,7 @@ extension _UnsafeBitset {
7979
internal var capacity: Int {
8080
@inline(__always)
8181
get {
82-
return wordCount * Word.capacity
82+
return wordCount &* Word.capacity
8383
}
8484
}
8585

0 commit comments

Comments
 (0)