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:45:52 +03:00
parent 7f3b91e688
commit 014c3c97f0
38 changed files with 201 additions and 201 deletions

View File

@@ -22,7 +22,7 @@ fn internal_uuid_v4(mut rng PRNG) string {
x += 0x3030303030303030
// write the ASCII codes to the buffer:
for c < 8 && i_buf < buflen {
d = byte(x)
d = u8(x)
unsafe {
buf[i_buf] = if d > 0x39 { d + 0x27 } else { d }
}
@@ -33,7 +33,7 @@ fn internal_uuid_v4(mut rng PRNG) string {
}
// there are still some random bits in x:
x = x >> 8
d = byte(x)
d = u8(x)
unsafe {
// From https://www.ietf.org/rfc/rfc4122.txt :
// >> Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved

View File

@@ -39,14 +39,14 @@ pub fn (mut rng WyRandRNG) byte() byte {
// Can we extract a value from the buffer?
if rng.bytes_left >= 1 {
rng.bytes_left -= 1
value := byte(rng.buffer)
value := u8(rng.buffer)
rng.buffer >>= 8
return value
}
// Add a new value to the buffer
rng.buffer = rng.u64()
rng.bytes_left = 7
value := byte(rng.buffer)
value := u8(rng.buffer)
rng.buffer >>= 8
return value
}