Fix bug in attestation val. bitfield checking

There was a logic error
This commit is contained in:
Paul Hauner 2018-09-30 14:24:42 +09:30
parent a87fe88d97
commit 496adc0f0b
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C

View File

@ -161,7 +161,7 @@ fn bytes_for_bits(bits: usize) -> usize {
fn any_of_last_n_bits_are_set(byte: u8, n: usize) -> bool { fn any_of_last_n_bits_are_set(byte: u8, n: usize) -> bool {
for i in 0..n { for i in 0..n {
let mask = 0_u8 >> 8_usize - i as usize; let mask = 1_u8 >> 7_usize.saturating_sub(i as usize);
if byte & mask > 0 { if byte & mask > 0 {
return true return true
} }