1
0
mirror of https://github.com/chai2010/advanced-go-programming-book.git synced 2025-05-23 20:02:22 +00:00

Update ch3-05-control-flow.md

fix errors.
This commit is contained in:
smallwhite 2019-02-20 20:05:00 +08:00 committed by GitHub
parent 6216460b30
commit a801c6c00d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -214,7 +214,7 @@ LOOP_END:
```
// func LoopAdd(cnt, v0, step int) int
TEXT ·LoopAdd(SB), NOSPLIT, $0-32
TEXT ·LoopAdd(SB), $0-32
MOVQ cnt+0(FP), AX // cnt
MOVQ v0+8(FP), BX // v0/result
MOVQ step+16(FP), CX // step
@ -225,12 +225,12 @@ LOOP_BEGIN:
LOOP_IF:
CMPQ DX, AX // compare i, cnt
JL LOOP_BODY // if i < cnt: goto LOOP_BODY
goto LOOP_END
JMP LOOP_END
LOOP_BODY:
ADDQ $1, DX // i++
ADDQ CX, BX // result += step
goto LOOP_IF
JMP LOOP_IF
LOOP_END: