1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cleanup: replace C for loops with range

This commit is contained in:
spaceface777
2020-02-24 17:55:16 +01:00
committed by GitHub
parent 5918946feb
commit ef8c1203b4
50 changed files with 168 additions and 170 deletions

View File

@@ -24,9 +24,9 @@ mut:
}
fn(c mut Crc32) generate_table(poly int) {
for i := 0; i < 256; i++ {
for i in 0..256 {
mut crc := u32(i)
for j := 0; j < 8; j++ {
for j in 0..8 {
if crc & u32(1) == u32(1) {
crc = (crc >> 1) ^ u32(poly)
} else {
@@ -39,7 +39,7 @@ fn(c mut Crc32) generate_table(poly int) {
fn(c &Crc32) sum32(b []byte) u32 {
mut crc := ~u32(0)
for i := 0; i < b.len; i++ {
for i in 0..b.len {
crc = c.table[byte(crc)^b[i]] ^ u32(crc >> u32(8))
}
return ~crc