mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 04:22:22 +00:00
ch3.4: fix swap
This commit is contained in:
parent
852e6026b3
commit
ace223d1d5
@ -278,8 +278,8 @@ Go语言中函数调用是一个复杂的问题,因为Go函数不仅仅要了
|
||||
```
|
||||
// func Swap(a, b int) (int, int)
|
||||
TEXT ·Swap(SB), $0-32
|
||||
MOVQ a-8*2(SP), AX // a
|
||||
MOVQ b-8*1(SP), BX // b
|
||||
MOVQ a+0(FP), AX // AX = a
|
||||
MOVQ b+8(FP), BX // BX = b
|
||||
|
||||
SWAP(AX, BX, CX) // AX, BX = b, a
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user