github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/riscvtest/lrot.go (about)

     1  package main
     2  
     3  import "os"
     4  
     5  func lrot8(x, c uint8) uint8 {
     6  	return (x << c) | (x >> (8 - c))
     7  }
     8  
     9  func main() {
    10  	x := new(uint8)
    11  	*x = 0x81
    12  	y := new(uint8)
    13  	*y = 0
    14  	os.Exit(int(lrot8(*x, 3) - 12))
    15  }