From 2bb85a8d50e125698734701a8e790dd4062132c7 Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 6 Dec 2018 13:36:05 -0600 Subject: [PATCH] fixed logic bug in bytes_to_u32_vec --- examples/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/src/lib.rs b/examples/src/lib.rs index 7b150e6..7870442 100644 --- a/examples/src/lib.rs +++ b/examples/src/lib.rs @@ -63,7 +63,9 @@ where { let mut output = vec![]; let mut buffer: [u8; 4] = [0, 0, 0, 0]; + let mut l: usize = 0; for (i, b) in bytes.enumerate() { + l = i; match i % 4 { 3 => { buffer[3] = b; @@ -73,7 +75,7 @@ where idx => buffer[idx] = b, } } - if buffer != [0, 0, 0, 0] { + if (l+1) % 4 != 0 { output.push(u32_from_bytes(&buffer)); } output