Files
Sylpheed/crates/sylpheed-xexdb/src/ppc.rs
MechaCat02 9c48c340bd fix(xexdb): clear the lint gate on the imported crates
rustfmt, then clippy -D warnings across the three new crates. Mechanical,
except three decisions that are stated rather than silently allowed:

  * lzx.rs gets file-scoped needless_range_loop/explicit_counter_loop allows.
    Index arithmetic IS the algorithm -- LZX is defined over symbol indices,
    Huffman slots and window positions, and a decompressor that is merely
    idiomatic is worth nothing if it is not bit-exact.
  * sylpheed-xexdb gets crate-scoped allows for needless_range_loop (nine
    sites index reg[r] where r is the PowerPC register number -- the index is
    the meaning), too_many_arguments and type_complexity. This code arrived
    whole from a retired repository; a refactor here would be an unreviewed
    edit dressed as a lint fix.
  * Everything else clippy asked for is FIXED, including all 14 doc-indent
    sites, the let-else, and a Prepared type alias in the binary.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 20:25:44 +02:00

32 lines
989 B
Rust

//! Back-compat shim. The full PPC disassembler now lives in
//! [`sylpheed_ppc::disasm`] (single source of truth, sitting on top of the
//! canonical decoder). This module preserves the legacy `Decoded { base, ext }`
//! surface so existing call sites keep compiling while the analysis crate
//! migrates to `DisasmText` directly.
use sylpheed_ppc::decoder::decode;
use sylpheed_ppc::disasm::format;
/// Decoded instruction carrying both base and (optional) extended mnemonic forms.
pub struct Decoded {
pub base: String,
pub ext: Option<String>,
}
impl Decoded {
/// Returns the preferred display form (extended if available, else base).
pub fn display(&self) -> &str {
self.ext.as_deref().unwrap_or(&self.base)
}
}
/// Disassemble one 32-bit big-endian PowerPC instruction.
pub fn disasm(instr: u32, addr: u32) -> Decoded {
let d = decode(instr, addr);
let t = format(&d);
Decoded {
base: t.disasm,
ext: t.ext_disasm,
}
}