Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dimpiax/bitwiseswitcher
Utility of managing with binary values
https://github.com/dimpiax/bitwiseswitcher
Last synced: about 2 months ago
JSON representation
Utility of managing with binary values
- Host: GitHub
- URL: https://github.com/dimpiax/bitwiseswitcher
- Owner: dimpiax
- Created: 2015-11-03T16:53:13.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-18T17:16:04.000Z (almost 9 years ago)
- Last Synced: 2023-03-26T13:54:12.025Z (almost 2 years ago)
- Language: Swift
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BitwiseSwitcher
Generic interpreter under IntegerType protocol for bitwise switching.var bitwiseSwitcher = BitwiseSwitcher(value: 14)
bitwiseSwitcher.insert(0)
print(bitwiseSwitcher) // BitwiseSwitcher(decimal=15 ~> "0001111")
bitwiseSwitcher.remove(1)
print(bitwiseSwitcher) // BitwiseSwitcher(decimal=13 ~> "0001101")
bitwiseSwitcher.operate(1)
bitwiseSwitcher.operate(2)
bitwiseSwitcher.operate(~3)
print(bitwiseSwitcher) // BitwiseSwitcher(decimal=7 ~> "0000111")
print(bitwiseSwitcher.decimal) // 7
bitwiseSwitcher.remove(1)// feature, that gives, in decimal format, included values from binary one
print(bitwiseSwitcher.consistValues) // [0, 2]
##### As addition to article: https://medium.com/@dimpiax/swift-bitwise-masking-p-2-8c74bf3c9630#.jkrprkp0p