Created
May 13, 2016 17:31
-
-
Save ericlagergren/ed15d4625bc9c721416a8a923cbf4333 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type mask [ ... ]uint64 | |
const ( | |
word = 64 | |
shift = 6 | |
) | |
func (m mask) isSet(i int) bool { | |
return (m[i>>shift]>>(uint64(i)&(word-1)))&1 != 0 | |
} | |
func (m *mask) set(i int) { | |
m[i>>shift] |= 1 << (uint64(i) & (word - 1)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment