Merge pull request #308 from dongcarl/2019-02-reformulate-unknown-bits-calculation

msgs: Reformulate unknown bits calculation w/ any
This commit is contained in:
Matt Corallo 2019-02-24 14:27:19 -05:00 committed by GitHub
commit 591362fdb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,25 +91,15 @@ impl LocalFeatures {
}
pub(crate) fn requires_unknown_bits(&self) -> bool {
for (idx, &byte) in self.flags.iter().enumerate() {
if idx != 0 && (byte & 0x55) != 0 {
return true;
} else if idx == 0 && (byte & 0x14) != 0 {
return true;
}
}
return false;
self.flags.iter().enumerate().any(|(idx, &byte)| {
( idx != 0 && (byte & 0x55) != 0 ) || ( idx == 0 && (byte & 0x14) != 0 )
})
}
pub(crate) fn supports_unknown_bits(&self) -> bool {
for (idx, &byte) in self.flags.iter().enumerate() {
if idx != 0 && byte != 0 {
return true;
} else if idx == 0 && (byte & 0xc4) != 0 {
return true;
}
}
return false;
self.flags.iter().enumerate().any(|(idx, &byte)| {
( idx != 0 && byte != 0 ) || ( idx == 0 && (byte & 0xc4) != 0 )
})
}
}