2018-12-11 23:02:50 -08:00
|
|
|
|
|
|
|
|
#include "textflag.h"
|
|
|
|
|
|
|
|
|
|
// func Sum(xs []uint64) uint64
|
|
|
|
|
TEXT ·Sum(SB),0,$0-32
|
|
|
|
|
MOVQ xs_base(FP), DX
|
2018-12-12 00:02:22 -08:00
|
|
|
MOVQ xs_len+8(FP), AX
|
|
|
|
|
XORQ CX, CX
|
2018-12-11 23:02:50 -08:00
|
|
|
loop:
|
2018-12-12 00:02:22 -08:00
|
|
|
CMPQ AX, $0x0
|
2018-12-11 23:02:50 -08:00
|
|
|
JE done
|
2018-12-12 00:02:22 -08:00
|
|
|
ADDQ (DX), CX
|
2018-12-11 23:02:50 -08:00
|
|
|
ADDQ $0x8, DX
|
2018-12-12 00:02:22 -08:00
|
|
|
DECQ AX
|
2018-12-11 23:02:50 -08:00
|
|
|
JMP loop
|
|
|
|
|
done:
|
2018-12-12 00:02:22 -08:00
|
|
|
MOVQ CX, ret+24(FP)
|
2018-12-11 23:02:50 -08:00
|
|
|
RET
|