Skip to content

Instantly share code, notes, and snippets.

@jacobsa

jacobsa/baz.go Secret

Created April 13, 2016 05:18
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 jacobsa/e1b3c19cae7fb430a8a03ee9b19b933a to your computer and use it in GitHub Desktop.
Save jacobsa/e1b3c19cae7fb430a8a03ee9b19b933a to your computer and use it in GitHub Desktop.
package main
import "fmt"
func foo() (x uint32)
func main() {
fmt.Println(foo())
}
// +build amd64
#include "textflag.h"
// func foo() (x uint32)
TEXT ·foo(SB), NOSPLIT, $0-4
// Stick 123 into the low 32 bits of X0.
MOVQ $123, AX
PINSRD $0, AX, X0
// Return them.
PEXTRD $0, X0, x+0(FP)
RET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment