mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
stdlib: remove bitwise operations on Bool
Bitwise operations on Bool are redundant with other logic operations that stdlib already provides. The only reason to have them was to avoid branching in the short-circuiting && and ||. rdar://19340952 Surprisingly, replacing & and | in the standard library with && and || brought performance improvements and no significant performance regressions: RecursiveOwnedParameter 1.14 SelectionSort 1.19 Swift SVN r24674
This commit is contained in:
@@ -185,7 +185,7 @@ public struct _UnitTestArrayBuffer<T> : _ArrayBufferType {
|
||||
/// the return from this function, as this implementation generates
|
||||
/// no shortcircuiting blocks.
|
||||
_precondition(_base.hasStorage, "Cannot index empty buffer")
|
||||
return (index >= 0) & (index < _base.value.count)
|
||||
return (index >= 0) && (index < _base.value.count)
|
||||
}
|
||||
|
||||
/// How many elements the buffer can store without reallocation
|
||||
|
||||
Reference in New Issue
Block a user