protocol BitwiseOperationsType
Inheritance | View Protocol Hierarchy → |
---|---|
Import | import Swift |
Static Variables
The empty bitset.
Also the identity element for |
and
^
, and the fixed point for
&
.
Declaration
static var allZeros: Self { get }
Instance Methods
Returns the intersection of bits set in lhs
and rhs
.
Complexity: O(1).
Declaration
func &(lhs: Self, rhs: Self) -> Self
Returns the bits that are set in exactly one of lhs
and rhs
.
Complexity: O(1).
Declaration
func ^(lhs: Self, rhs: Self) -> Self
Returns the union of bits set in lhs
and rhs
.
Complexity: O(1).
Declaration
func |(lhs: Self, rhs: Self) -> Self
Returns x ^ ~Self.allZeros
.
Complexity: O(1).
Declaration
prefix func ~(x: Self) -> Self
A set type with O(1) standard bitwise operators.
Each instance is a subset of
~Self.allZeros
.Axioms, where
x
is an instance ofSelf
:x | Self.allZeros == x
x ^ Self.allZeros == x
x & Self.allZeros == .allZeros
x & ~Self.allZeros == x
~x == x ^ ~Self.allZeros