This commit is contained in:
Trevor Spiteri 2019-08-10 20:37:23 +02:00
parent 7d9f738b70
commit 3a4a99a380
1 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ where
debug_assert!(!a.is_empty());
let mut bits = I::NBITS - dump_bits;
let mut acc = I::ZERO;
for byte in a.as_bytes() {
for &byte in a.as_bytes() {
let val = byte - b'0';
if bits < 1 {
// round
@ -53,7 +53,7 @@ where
debug_assert!(!a.is_empty());
let mut bits = I::NBITS - dump_bits;
let mut acc = I::ZERO;
for byte in a.as_bytes() {
for &byte in a.as_bytes() {
let val = byte - b'0';
if bits < 3 {
acc = (acc << bits) + I::from(val >> (3 - bits));
@ -73,7 +73,7 @@ where
debug_assert!(!a.is_empty());
let mut bits = I::NBITS - dump_bits;
let mut acc = I::ZERO;
for byte in a.as_bytes() {
for &byte in a.as_bytes() {
// We know that byte is a valid hex:
// * b'0'..=b'9' (0x30..=0x39) => val = byte & 0x0f
// * b'A'..=b'F' (0x41..=0x46) => val = byte & 0x0f + 9