Skip to content

Instantly share code, notes, and snippets.

@kurrik
Created August 26, 2012 10:13
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 kurrik/3476837 to your computer and use it in GitHub Desktop.
Save kurrik/3476837 to your computer and use it in GitHub Desktop.
How to negate bits in a bitmask in Go
package main
import "fmt"
func main() {
foo := 4 | 2 | 16
foo &= (511 ^ 4)
fmt.Printf("%b", foo)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment