Last active
December 18, 2018 09:19
-
-
Save mmcloughlin/dfb91a6a97727666b90b8ccb5c0c553d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| //build ignore | |
| #include "textflag.h" | |
| TEXT ·ArrayIndex3(SB),0,$0-72 | |
| MOVQ s_Array_3+32(FP), AX | |
| MOVQ AX, ret+64(FP) | |
| RET |
This file contains hidden or 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
| package asmdeclarray | |
| import ( | |
| "testing" | |
| "testing/quick" | |
| ) | |
| func TestArrayIndex3(t *testing.T) { | |
| if err := quick.CheckEqual(ArrayIndex3, Expect, nil); err != nil { | |
| t.Fatal(err) | |
| } | |
| } |
This file contains hidden or 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
| package asmdeclarray | |
| type Struct struct { | |
| Padding uint64 | |
| Array [7]uint64 | |
| } | |
| // ArrayIndex3 returns s.Array[3]. | |
| func ArrayIndex3(s Struct) uint64 | |
| // Expect is the pure Go implementation. | |
| //go:noinline | |
| func Expect(s Struct) uint64 { return s.Array[3] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment