Created
January 28, 2019 12:00
-
-
Save salmaanahmed/4bb61c8ac7860b3ff699ba20d90c0083 to your computer and use it in GitHub Desktop.
Add two computed properties, isEven and isOdd, and a function isMultiple to the BinaryInteger protocol.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// On protocol BinaryInteger | |
@_transparent | |
public var isEven: Bool { return _lowWord % 2 == 0 } | |
@_transparent | |
public var isOdd: Bool { return !isEven } | |
func isMultiple(of other: Self) -> Bool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment