Skip to content

Commit d0357fa

Browse files
committed
examples/sha1: use comments (mmcloughlin#41)
1 parent 9403305 commit d0357fa

File tree

2 files changed

+1283
-1114
lines changed

2 files changed

+1283
-1114
lines changed

examples/sha1/asm.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ func main() {
1818
w := AllocLocal(64)
1919
W := func(r int) Mem { return w.Offset((r % 16) * 4) }
2020

21-
// Load initial hash.
21+
Comment("Load initial hash.")
2222
hash := [5]Register{GP32(), GP32(), GP32(), GP32(), GP32()}
2323
for i, r := range hash {
2424
MOVL(h.Offset(4*i), r)
2525
}
2626

27-
// Initialize registers.
27+
Comment("Initialize registers.")
2828
a, b, c, d, e := GP32(), GP32(), GP32(), GP32(), GP32()
2929
for i, r := range []Register{a, b, c, d, e} {
3030
MOVL(hash[i], r)
@@ -42,6 +42,7 @@ func main() {
4242
}
4343

4444
for r := 0; r < 80; r++ {
45+
Commentf("Round %d.", r)
4546
q := quarter[r/20]
4647

4748
// Load message value.
@@ -72,12 +73,12 @@ func main() {
7273
a, b, c, d, e = t, a, b, c, d
7374
}
7475

75-
// Final add.
76+
Comment("Final add.")
7677
for i, r := range []Register{a, b, c, d, e} {
7778
ADDL(r, hash[i])
7879
}
7980

80-
// Store results back.
81+
Comment("Store results back.")
8182
for i, r := range hash {
8283
MOVL(r, h.Offset(4*i))
8384
}

0 commit comments

Comments
 (0)