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

all: byte => u8

This commit is contained in:
Alexander Medvednikov
2022-04-15 14:58:56 +03:00
parent b49d873217
commit d4a0d6f73c
221 changed files with 1365 additions and 1365 deletions

View File

@@ -40,7 +40,7 @@ fn (mut c Crc32) generate_table(poly int) {
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)
crc = c.table[u8(crc) ^ b[i]] ^ (crc >> 8)
}
return ~crc
}

View File

@@ -34,7 +34,7 @@ pub fn sum32(data []byte) u32 {
// sum32_bytes returns a fnv1a hash of the struct `s`.
[direct_array_access; inline]
pub fn sum32_struct<T>(s &T) u32 {
bp := unsafe { &byte(s) }
bp := unsafe { &u8(s) }
sz := int(sizeof(T))
mut hash := fnv1a.fnv32_offset_basis
for i in 0 .. sz {
@@ -89,7 +89,7 @@ pub fn sum64_bytes(data &byte, data_len int) u64 {
// sum64_bytes returns a fnv1a hash of the struct `s`.
[direct_array_access; inline]
pub fn sum64_struct<T>(s &T) u64 {
bp := unsafe { &byte(s) }
bp := unsafe { &u8(s) }
sz := int(sizeof(T))
mut hash := fnv1a.fnv64_offset_basis
for i in 0 .. sz {

View File

@@ -23,5 +23,5 @@ pub fn sum64_string(key string, seed u64) u64 {
[inline]
pub fn sum64(key []byte, seed u64) u64 {
return wyhash_c(&byte(key.data), u64(key.len), seed)
return wyhash_c(&u8(key.data), u64(key.len), seed)
}