Skip to content

Instantly share code, notes, and snippets.

@earnubs
Last active May 20, 2019 11:33
Show Gist options
  • Save earnubs/5c0e2baa645c53807793aae1f56f236b to your computer and use it in GitHub Desktop.
Save earnubs/5c0e2baa645c53807793aae1f56f236b to your computer and use it in GitHub Desktop.
//(0b001 << 0b010).toString(2)
const isBuilding = 0b001;
const hasFinished = 0b010;
const hasFailed = 0b100;
let combinedBuildState = 0b000;
combinedBuildState = combinedBuildState | isBuilding;
combinedBuildState = combinedBuildState | hasFinished;
console.log(combinedBuildState.toString(2))
console.log('---');
console.log(!!(combinedBuildState & isBuilding));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment