small stuff

This commit is contained in:
2026-06-13 13:47:12 -04:00
parent 1e39675c29
commit 84e184518f
+7 -7
View File
@@ -172,7 +172,7 @@ impl Code {
self.bytes.push(0xc3); self.bytes.push(0xc3);
} }
pub fn sub(&mut self, mut dst: Reg, src: impl Into<Imm>) -> ERes { pub fn sub(&mut self, dst: Reg, src: impl Into<Imm>) -> ERes {
let mut src = src.into(); let mut src = src.into();
let mut width = src.width_signed()?; let mut width = src.width_signed()?;
let dst_width = dst.width().min(Width::B32); let dst_width = dst.width().min(Width::B32);
@@ -188,16 +188,16 @@ impl Code {
src = src.reinterpret(dst_width); src = src.reinterpret(dst_width);
width = src.width_signed()?; width = src.width_signed()?;
} }
if dst.width() == Width::B8 { if dst.width() == Width::B8 {
self.bytes.push(0x80); self.bytes.push(0x80);
} else if width == Width::B8 {
self.bytes.push(0x83);
} else { } else {
if width == Width::B8 { self.bytes.push(0x81);
self.bytes.push(0x83); width = dst_width;
} else {
self.bytes.push(0x81);
width = dst_width;
}
} }
self.bytes.push(modrm(0b11, 0b101, dst.base())); self.bytes.push(modrm(0b11, 0b101, dst.base()));
self.imm(src, width); self.imm(src, width);
Ok(()) Ok(())