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

@@ -29,7 +29,7 @@ const (
pub fn from_bytes(input []byte) BitField {
mut output := new(input.len * 8)
for i, b in input {
mut ob := byte(0)
mut ob := u8(0)
if b & 0b10000000 > 0 {
ob |= 0b00000001
}

View File

@@ -133,7 +133,7 @@ fn test_hamming() {
}
fn test_bf_from_bytes() {
input := [byte(0x01), 0xF0, 0x0F, 0xF0, 0xFF]
input := [u8(0x01), 0xF0, 0x0F, 0xF0, 0xFF]
output := bitfield.from_bytes(input).str()
assert output == '00000001' + '11110000' + '00001111' + '11110000' + '11111111'
newoutput := bitfield.from_str(output).str()
@@ -141,7 +141,7 @@ fn test_bf_from_bytes() {
}
fn test_bf_from_bytes_lowest_bits_first() {
input := [byte(0x01), 0xF0]
input := [u8(0x01), 0xF0]
output := bitfield.from_bytes_lowest_bits_first(input).str()
assert output == '10000000' + '00001111'
newoutput := bitfield.from_str(output).str()
@@ -161,7 +161,7 @@ fn test_bf_from_str() {
output := bitfield.from_str(input)
mut result := 1
for i in 0 .. len {
if input[i] != byte(output.get_bit(i)) + 48 {
if input[i] != u8(output.get_bit(i)) + 48 {
result = 0
}
}