Skip to content

Instantly share code, notes, and snippets.

@zgrge
Created June 25, 2017 11:54
Show Gist options
  • Save zgrge/957e77c76adfd8b1ab54117ae019af52 to your computer and use it in GitHub Desktop.
Save zgrge/957e77c76adfd8b1ab54117ae019af52 to your computer and use it in GitHub Desktop.
import "unsafe"
func main() {
var x uint32 = 0x01020304
switch *(*byte)(unsafe.Pointer(&x)) {
case 0x01:
println("Big Endian")
case 0x04:
println("Little Endian")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment