github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/riscvtest/bits.go (about) 1 package main 2 3 import "os" 4 5 func main() { 6 x := new(int) 7 *x = 0x10000000 8 9 y := new(int) 10 11 *y = 1 12 *x |= 0x01100000 // now 0x1110000 13 14 *y = 1 15 *x &= 0x11011111 // now 0x1100000 16 17 *y = 1 18 *x ^= 0x11000000 // now 0 19 20 *y = 1 21 if *x != 0 { 22 os.Exit(1) 23 } 24 os.Exit(0) 25 }