Skip to content

Instantly share code, notes, and snippets.

@mmcloughlin
Last active December 18, 2018 09:19
Show Gist options
  • Select an option

  • Save mmcloughlin/dfb91a6a97727666b90b8ccb5c0c553d to your computer and use it in GitHub Desktop.

Select an option

Save mmcloughlin/dfb91a6a97727666b90b8ccb5c0c553d to your computer and use it in GitHub Desktop.
//build ignore
#include "textflag.h"
TEXT ·ArrayIndex3(SB),0,$0-72
MOVQ s_Array_3+32(FP), AX
MOVQ AX, ret+64(FP)
RET
package asmdeclarray
import (
"testing"
"testing/quick"
)
func TestArrayIndex3(t *testing.T) {
if err := quick.CheckEqual(ArrayIndex3, Expect, nil); err != nil {
t.Fatal(err)
}
}
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