Created
June 28, 2016 23:20
-
-
Save ericlagergren/af4215805a0d88e426fde0c55696df3c 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
$ cat test.go | |
package main | |
import "fmt" | |
var x int64 = +1 | |
func main() { | |
m := signum(x) | |
fmt.Println(m) | |
} | |
//go:noinline | |
func signum(x int64) int { | |
return int((x >> 63) | int64(uint64(-x)>>63)) | |
} | |
vagrant@vagrant-ubuntu-trusty-32:~/gopath/src/github.com/EricLagergren/decimal$ go run test.go | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment