swap literal priority

This commit is contained in:
Jean-Marie 'Histausse' Mineau 2024-02-08 15:50:42 +01:00
parent f5b5957ff5
commit 93f70040fd
Signed by: histausse
GPG key ID: B66AEEDA9B645AD2
3 changed files with 121 additions and 121 deletions

View file

@ -229,7 +229,7 @@ impl Instruction {
if v != 0 {
// TODO: is it enforced on actual android system?
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '10x' (00|op) \
"Dalvik instruction format for op 0x{op:x}: '10x' (00|op) \
requires the first byte to be 0 found {v}"
)));
}
@ -277,7 +277,7 @@ impl Instruction {
if v != 0 {
// TODO: is it enforced on actual android system?
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '20t' (00|op AAAA) \
"Dalvik instruction format for op 0x{op:x}: '20t' (00|op AAAA) \
requires the first byte to be 0 found {v}"
)));
}
@ -385,7 +385,7 @@ impl Instruction {
if v != 0 {
// TODO: is it enforced on actual android system?
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '30t' (00|op AAAA AAAA) \
"Dalvik instruction format for op 0x{op:x}: '30t' (00|op AAAA AAAA) \
requires the first byte to be 0 found {v}"
)));
}
@ -403,7 +403,7 @@ impl Instruction {
if v != 0 {
// TODO: is it enforced on actual android system?
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '32x' (00|op AAAA BBBB) \
"Dalvik instruction format for op 0x{op:x}: '32x' (00|op AAAA BBBB) \
requires the first byte to be 0 found {v}"
)));
}
@ -452,7 +452,7 @@ impl Instruction {
let vg = val & 0b0000_1111;
if a > 5 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35c' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35c' (A|G|op BBBB F|E|D|C) \
requires A to be between 0 and 5, found {a}"
)));
}
@ -485,7 +485,7 @@ impl Instruction {
let vg = val & 0b0000_1111;
if a > 5 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35ms' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35ms' (A|G|op BBBB F|E|D|C) \
requires A to be between 0 and 5, found {a}"
)));
}
@ -518,7 +518,7 @@ impl Instruction {
let vg = val & 0b0000_1111;
if a > 5 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35mi' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35mi' (A|G|op BBBB F|E|D|C) \
requires A to be between 0 and 5, found {a}"
)));
}
@ -575,7 +575,7 @@ impl Instruction {
let vg = val & 0b0000_1111;
if a > 5 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '45cc' (A|G|op BBBB F|E|D|C HHHH) \
"Dalvik instruction format for op 0x{op:x}: '45cc' (A|G|op BBBB F|E|D|C HHHH) \
requires A to be between 0 and 5, found {a}"
)));
}
@ -673,13 +673,13 @@ impl Serializable for Instruction {
Self::Format12X { vb, va, op } => {
if vb & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '12x' (B|A|op) \
"Dalvik instruction format for op 0x{op:x}: '12x' (B|A|op) \
requires B to be between 0 and 15, found {vb}"
)));
}
if va & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '12x' (B|A|op) \
"Dalvik instruction format for op 0x{op:x}: '12x' (B|A|op) \
requires A to be between 0 and 15, found {va}"
)));
}
@ -690,14 +690,14 @@ impl Serializable for Instruction {
Self::Format11N { b, va, op } => {
if *b < -8 || *b > 7 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '11n' (B|A|op) \
"Dalvik instruction format for op 0x{op:x}: '11n' (B|A|op) \
requires B to be between -8 and 7, found {b}"
)));
}
let b = b.to_be_bytes()[0] & 0b0000_1111;
if va & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '11n' (B|A|op) \
"Dalvik instruction format for op 0x{op:x}: '11n' (B|A|op) \
requires A to be between 0 and 15, found {va}"
)));
}
@ -763,13 +763,13 @@ impl Serializable for Instruction {
Self::Format22T { vb, va, op, c } => {
if vb & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '22t' (B|A|op CCCC) \
"Dalvik instruction format for op 0x{op:x}: '22t' (B|A|op CCCC) \
requires B to be between 0 and 15, found {vb}"
)));
}
if va & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '22t' (B|A|op CCCC) \
"Dalvik instruction format for op 0x{op:x}: '22t' (B|A|op CCCC) \
requires A to be between 0 and 15, found {va}"
)));
}
@ -781,13 +781,13 @@ impl Serializable for Instruction {
Self::Format22S { vb, va, op, c } => {
if vb & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '22s' (B|A|op CCCC) \
"Dalvik instruction format for op 0x{op:x}: '22s' (B|A|op CCCC) \
requires B to be between 0 and 15, found {vb}"
)));
}
if va & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '22s' (B|A|op CCCC) \
"Dalvik instruction format for op 0x{op:x}: '22s' (B|A|op CCCC) \
requires A to be between 0 and 15, found {va}"
)));
}
@ -800,13 +800,13 @@ impl Serializable for Instruction {
Self::Format22C { vb, va, op, c } => {
if vb & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '22c' (B|A|op CCCC) \
"Dalvik instruction format for op 0x{op:x}: '22c' (B|A|op CCCC) \
requires B to be between 0 and 15, found {vb}"
)));
}
if va & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '22c' (B|A|op CCCC) \
"Dalvik instruction format for op 0x{op:x}: '22c' (B|A|op CCCC) \
requires A to be between 0 and 15, found {va}"
)));
}
@ -818,13 +818,13 @@ impl Serializable for Instruction {
Self::Format22CS { vb, va, op, c } => {
if vb & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '22cs' (B|A|op CCCC) \
"Dalvik instruction format for op 0x{op:x}: '22cs' (B|A|op CCCC) \
requires B to be between 0 and 15, found {vb}"
)));
}
if va & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '22cs' (B|A|op CCCC) \
"Dalvik instruction format for op 0x{op:x}: '22cs' (B|A|op CCCC) \
requires A to be between 0 and 15, found {va}"
)));
}
@ -887,37 +887,37 @@ impl Serializable for Instruction {
} => {
if *a > 5 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35c' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35c' (A|G|op BBBB F|E|D|C) \
requires A to be between 0 and 5, found {a}"
)));
}
if vg & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35c' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35c' (A|G|op BBBB F|E|D|C) \
requires G to be between 0 and 15, found {vg}"
)));
}
if vf & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35c' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35c' (A|G|op BBBB F|E|D|C) \
requires F to be between 0 and 15, found {vf}"
)));
}
if ve & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35c' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35c' (A|G|op BBBB F|E|D|C) \
requires E to be between 0 and 15, found {ve}"
)));
}
if vd & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35c' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35c' (A|G|op BBBB F|E|D|C) \
requires D to be between 0 and 15, found {vd}"
)));
}
if vc & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35c' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35c' (A|G|op BBBB F|E|D|C) \
requires C to be between 0 and 15, found {vc}"
)));
}
@ -942,37 +942,37 @@ impl Serializable for Instruction {
} => {
if *a > 5 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35ms' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35ms' (A|G|op BBBB F|E|D|C) \
requires A to be between 0 and 5, found {a}"
)));
}
if vg & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35ms' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35ms' (A|G|op BBBB F|E|D|C) \
requires G to be between 0 and 15, found {vg}"
)));
}
if vf & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35ms' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35ms' (A|G|op BBBB F|E|D|C) \
requires F to be between 0 and 15, found {vf}"
)));
}
if ve & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35ms' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35ms' (A|G|op BBBB F|E|D|C) \
requires E to be between 0 and 15, found {ve}"
)));
}
if vd & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35ms' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35ms' (A|G|op BBBB F|E|D|C) \
requires D to be between 0 and 15, found {vd}"
)));
}
if vc & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35ms' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35ms' (A|G|op BBBB F|E|D|C) \
requires C to be between 0 and 15, found {vc}"
)));
}
@ -997,37 +997,37 @@ impl Serializable for Instruction {
} => {
if *a > 5 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35mi' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35mi' (A|G|op BBBB F|E|D|C) \
requires A to be between 0 and 5, found {a}"
)));
}
if vg & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35mi' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35mi' (A|G|op BBBB F|E|D|C) \
requires G to be between 0 and 15, found {vg}"
)));
}
if vf & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35mi' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35mi' (A|G|op BBBB F|E|D|C) \
requires F to be between 0 and 15, found {vf}"
)));
}
if ve & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35mi' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35mi' (A|G|op BBBB F|E|D|C) \
requires E to be between 0 and 15, found {ve}"
)));
}
if vd & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35mi' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35mi' (A|G|op BBBB F|E|D|C) \
requires D to be between 0 and 15, found {vd}"
)));
}
if vc & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '35mi' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '35mi' (A|G|op BBBB F|E|D|C) \
requires C to be between 0 and 15, found {vc}"
)));
}
@ -1071,37 +1071,37 @@ impl Serializable for Instruction {
} => {
if *a > 5 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '45cc' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '45cc' (A|G|op BBBB F|E|D|C) \
requires A to be between 0 and 5, found {a}"
)));
}
if vg & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '45cc' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '45cc' (A|G|op BBBB F|E|D|C) \
requires G to be between 0 and 15, found {vg}"
)));
}
if vf & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '45cc' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '45cc' (A|G|op BBBB F|E|D|C) \
requires F to be between 0 and 15, found {vf}"
)));
}
if ve & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '45cc' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '45cc' (A|G|op BBBB F|E|D|C) \
requires E to be between 0 and 15, found {ve}"
)));
}
if vd & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '45cc' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '45cc' (A|G|op BBBB F|E|D|C) \
requires D to be between 0 and 15, found {vd}"
)));
}
if vc & 0b1111_0000 != 0 {
return Err(Error::InconsistantStruct(format!(
"Dalvik instruction format '45cc' (A|G|op BBBB F|E|D|C) \
"Dalvik instruction format for op 0x{op:x}: '45cc' (A|G|op BBBB F|E|D|C) \
requires C to be between 0 and 15, found {vc}"
)));
}