标签: objective-c enums bit-shift
我现在不太了解移位如何工作。给定以下枚举,if statement如何确定为真?
if statement
typedef NS_OPTIONS(uint16_t, flags) { flagsFirst = 1 << 0, flagsSecond = 1 << 1, flagsThird = 1 << 2, flagsFourth = 1 << 3 }; if (flags & flagsThird) { // ... }