OPBitMaskNumber handling bit-mask library.
pod 'OPBitMaskNumber'
typedef NS_ENUM(NSInteger, TestMaskType) {
TestMaskTypeDefault = 1,
TestMaskTypeValue1,
TestMaskTypeValue2,
TestMaskTypeSubSub
};
OPBitMaskNumber *bitMaskNumber = [OPBitMaskNumber bitMaskNumberWithValue:@(0)];
bitMaskNumber.originalValue; // => @0
[bitMaskNumber maskingBitToOnAtIndex:TestMaskTypeDefault];// bit to on
[bitMaskNumber maskingBitToOffAtIndex:TestMaskTypeDefault]; // bit to off
[bitMaskNumber togglingBitAtIndex:TestMaskTypeDefault];// toggle bit => bit to on
[bitMaskNumber stateAtIndex:TestMaskTypeDefault];// bit state : YES
bitMaskNumber.originalValue; // => @(2^1) get total value
See OPBitMaskNumberTests
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
MIT