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:
@@ -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
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user