Skip to content

Commit

Permalink
examples: forgot to regenerate
Browse files Browse the repository at this point in the history
Sync READMEs with example code.

Updates mmcloughlin#31
  • Loading branch information
mmcloughlin committed Jan 6, 2019
1 parent 1cdd4b9 commit 87ffa68
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ func main() {
s := GP64()
XORQ(s, s)
LABEL("loop")
CMPQ(n, operand.Imm(0))
JE(operand.LabelRef("done"))
ADDQ(operand.Mem{Base: ptr}, s)
ADDQ(operand.Imm(8), ptr)
CMPQ(n, Imm(0))
JE(LabelRef("done"))
ADDQ(Mem{Base: ptr}, s)
ADDQ(Imm(8), ptr)
DECQ(n)
JMP(operand.LabelRef("loop"))
JMP(LabelRef("loop"))
LABEL("done")
Store(s, ReturnIndex(0))
RET()
Expand Down
14 changes: 7 additions & 7 deletions examples/fnv1a/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ func main() {
ptr := Load(Param("data").Base(), GP64())
n := Load(Param("data").Len(), GP64())

h := reg.RAX
MOVQ(operand.Imm(OffsetBasis), h)
h := RAX
MOVQ(Imm(OffsetBasis), h)
p := GP64()
MOVQ(operand.Imm(Prime), p)
MOVQ(Imm(Prime), p)

LABEL("loop")
CMPQ(n, operand.Imm(0))
JE(operand.LabelRef("done"))
CMPQ(n, Imm(0))
JE(LabelRef("done"))
b := GP64()
MOVBQZX(operand.Mem{Base: ptr}, b)
MOVBQZX(Mem{Base: ptr}, b)
XORQ(b, h)
MULQ(p)
INCQ(ptr)
DECQ(n)

JMP(operand.LabelRef("loop"))
JMP(LabelRef("loop"))
LABEL("done")
Store(h, ReturnIndex(0))
RET()
Expand Down
10 changes: 5 additions & 5 deletions examples/sum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ func main() {
s := GP64()
XORQ(s, s)
LABEL("loop")
CMPQ(n, operand.Imm(0))
JE(operand.LabelRef("done"))
ADDQ(operand.Mem{Base: ptr}, s)
ADDQ(operand.Imm(8), ptr)
CMPQ(n, Imm(0))
JE(LabelRef("done"))
ADDQ(Mem{Base: ptr}, s)
ADDQ(Imm(8), ptr)
DECQ(n)
JMP(operand.LabelRef("loop"))
JMP(LabelRef("loop"))
LABEL("done")
Store(s, ReturnIndex(0))
RET()
Expand Down

0 comments on commit 87ffa68

Please sign in to comment.