Skip to content

Instantly share code, notes, and snippets.

@pixelrevision
Created November 1, 2012 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pixelrevision/3996453 to your computer and use it in GitHub Desktop.
Save pixelrevision/3996453 to your computer and use it in GitHub Desktop.
Bitmask javascript
var BitField = function(){};
BitField.isSet = function(i, flag){
return (i & flag) === flag;
}
BitField.setFlag = function(i, flag){
return i | flag;
}
BitField.removeFlag = function(i, flag){
return i & ~flag;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment