Skip to content

Commit b075f9f

Browse files
committed
rand: fix for ./v -cc clang -cflags -fsanitize=alignment -cflags -fno-sanitize-recover=all test vlib/rand/
1 parent 8b20f61 commit b075f9f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎vlib/rand/rand.c.v‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ fn read_32(mut rng PRNG, mut buf []u8) {
195195
@[direct_array_access]
196196
fn read_64(mut rng PRNG, mut buf []u8) {
197197
p64 := unsafe { &u64(buf.data) }
198+
if u64(p64) & 0xF != 0 {
199+
for i in 0 .. buf.len {
200+
buf[i] = rng.u8()
201+
}
202+
return
203+
}
198204
u64s := buf.len / 8
199205
for i in 0 .. u64s {
200206
unsafe {

0 commit comments

Comments
 (0)