mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
cleanup: replace C for loops with range
This commit is contained in:
parent
5918946feb
commit
ef8c1203b4
50 changed files with 168 additions and 170 deletions
|
@ -105,7 +105,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
|
|||
mut h6 := dig.h[6]
|
||||
mut h7 := dig.h[7]
|
||||
for p.len >= Chunk {
|
||||
for i := 0; i < 16; i++ {
|
||||
for i in 0..16 {
|
||||
j := i * 8
|
||||
w[i] = (u64(p[j])<<56) | (u64(p[j + 1])<<48) | (u64(p[j + 2])<<40) | (u64(p[j + 3])<<32) | (u64(p[j + 4])<<24) | (u64(p[j + 5])<<16) | (u64(p[j + 6])<<8) | u64(p[j + 7])
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ fn block_generic(dig mut Digest, p_ []byte) {
|
|||
mut f := h5
|
||||
mut g := h6
|
||||
mut h := h7
|
||||
for i := 0; i < 80; i++ {
|
||||
for i in 0..80 {
|
||||
t1 := h + (bits.rotate_left_64(e, -14) ^ bits.rotate_left_64(e, -18) ^ bits.rotate_left_64(e, -41)) + ((e & f) ^ (~e & g)) + _k[i] + w[i]
|
||||
t2 := (bits.rotate_left_64(a, -28) ^ bits.rotate_left_64(a, -34) ^ bits.rotate_left_64(a, -39)) + ((a & b) ^ (a & c) ^ (b & c))
|
||||
h = g
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue