Skip to content

Commit

Permalink
examples/sum: attempt to avoid asmfmt mismatch
Browse files Browse the repository at this point in the history
Updates #41
Updates #8
  • Loading branch information
mmcloughlin committed Jan 11, 2019
1 parent 3ca82be commit 943d5f0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ func main() {
s := GP64()
XORQ(s, s)
Comment("Loop until zero bytes remain.")
Label("loop")
Comment("Loop until zero bytes remain.")
CMPQ(n, Imm(0))
JE(LabelRef("done"))
Expand All @@ -119,8 +119,8 @@ func main() {
DECQ(n)
JMP(LabelRef("loop"))
Comment("Store sum to return value.")
Label("done")
Comment("Store sum to return value.")
Store(s, ReturnIndex(0))
RET()
Generate()
Expand All @@ -143,8 +143,8 @@ TEXT ·Sum(SB), NOSPLIT, $0-32
// Initialize sum register to zero.
XORQ DX, DX
// Loop until zero bytes remain.
loop:
// Loop until zero bytes remain.
CMPQ CX, $0x00
JE done
Expand All @@ -156,8 +156,8 @@ loop:
DECQ CX
JMP loop
// Store sum to return value.
done:
// Store sum to return value.
MOVQ DX, ret+24(FP)
RET
```
Expand Down
4 changes: 2 additions & 2 deletions examples/sum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ func main() {
s := GP64()
XORQ(s, s)

Comment("Loop until zero bytes remain.")
Label("loop")
Comment("Loop until zero bytes remain.")
CMPQ(n, Imm(0))
JE(LabelRef("done"))

Expand All @@ -27,8 +27,8 @@ func main() {
DECQ(n)
JMP(LabelRef("loop"))

Comment("Store sum to return value.")
Label("done")
Comment("Store sum to return value.")
Store(s, ReturnIndex(0))
RET()
Generate()
Expand Down
4 changes: 2 additions & 2 deletions examples/sum/asm.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func main() {
s := GP64()
XORQ(s, s)

Comment("Loop until zero bytes remain.")
Label("loop")
Comment("Loop until zero bytes remain.")
CMPQ(n, Imm(0))
JE(LabelRef("done"))

Expand All @@ -30,8 +30,8 @@ func main() {
DECQ(n)
JMP(LabelRef("loop"))

Comment("Store sum to return value.")
Label("done")
Comment("Store sum to return value.")
Store(s, ReturnIndex(0))
RET()
Generate()
Expand Down
4 changes: 2 additions & 2 deletions examples/sum/sum.s
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ TEXT ·Sum(SB), NOSPLIT, $0-32
// Initialize sum register to zero.
XORQ DX, DX

// Loop until zero bytes remain.
loop:
// Loop until zero bytes remain.
CMPQ CX, $0x00
JE done

Expand All @@ -23,7 +23,7 @@ loop:
DECQ CX
JMP loop

// Store sum to return value.
done:
// Store sum to return value.
MOVQ DX, ret+24(FP)
RET

0 comments on commit 943d5f0

Please sign in to comment.