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

tools: make v test-cleancode test everything by default (#10050)

This commit is contained in:
Delyan Angelov
2021-05-08 13:32:29 +03:00
committed by GitHub
parent cba2cb6b9c
commit 8a380f4699
132 changed files with 3230 additions and 3440 deletions

View File

@ -23,10 +23,10 @@ mut:
table []u32
}
fn(mut c Crc32) generate_table(poly int) {
for i in 0..256 {
fn (mut c Crc32) generate_table(poly int) {
for i in 0 .. 256 {
mut crc := u32(i)
for _ in 0..8 {
for _ in 0 .. 8 {
if crc & u32(1) == u32(1) {
crc = (crc >> 1) ^ u32(poly)
} else {
@ -37,15 +37,15 @@ fn(mut c Crc32) generate_table(poly int) {
}
}
fn(c &Crc32) sum32(b []byte) u32 {
fn (c &Crc32) sum32(b []byte) u32 {
mut crc := ~u32(0)
for i in 0..b.len {
crc = c.table[byte(crc)^b[i]] ^ (crc >> 8)
for i in 0 .. b.len {
crc = c.table[byte(crc) ^ b[i]] ^ (crc >> 8)
}
return ~crc
}
pub fn(c &Crc32) checksum(b []byte) u32 {
pub fn (c &Crc32) checksum(b []byte) u32 {
return c.sum32(b)
}
@ -58,6 +58,6 @@ pub fn new(poly int) &Crc32 {
// calculate crc32 using ieee
pub fn sum(b []byte) u32 {
c := new(int(ieee))
c := new(int(crc32.ieee))
return c.sum32(b)
}