mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
continued porting of test cases
This commit is contained in:
@@ -2,7 +2,7 @@ use crate::common::Result;
|
||||
use crate::qrcode::decoder::ErrorCorrectionLevel;
|
||||
|
||||
impl ErrorCorrectionLevel {
|
||||
pub fn ECLevelFromBits(bits: u8, isMicro: bool) -> Self {
|
||||
pub fn ECLevelFromBitsSigned(bits: i8, isMicro: bool) -> Self {
|
||||
if (isMicro) {
|
||||
let LEVEL_FOR_BITS: [ErrorCorrectionLevel; 8] = [
|
||||
ErrorCorrectionLevel::L,
|
||||
@@ -24,4 +24,8 @@ impl ErrorCorrectionLevel {
|
||||
];
|
||||
return LEVEL_FOR_BITS[bits as usize & 0x3];
|
||||
}
|
||||
|
||||
pub fn ECLevelFromBits(bits: u8, isMicro: bool) -> Self {
|
||||
Self::ECLevelFromBitsSigned(bits as i8, isMicro)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,4 +125,9 @@ impl FormatInformation {
|
||||
pub fn isValid(&self) -> bool {
|
||||
self.hammingDistance <= 3
|
||||
}
|
||||
|
||||
pub fn cpp_eq(&self, other: &Self) -> bool {
|
||||
self.data_mask == other.data_mask
|
||||
&& self.error_correction_level == other.error_correction_level
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user