Ad

i fixed it

Code
Diff
  • use std::arch::asm;
    
    #[cfg(target_arch = "x86_64")]
    pub fn multiply(a: usize, b: usize) -> usize {
        let mut result: usize;
        unsafe {
            asm!(
                "mov {result}, 0",
                "2:",
                "add {result}, {a}",
                "dec {b}", // i mean like no ones gonna notice if we modify it :3
                "cmp {b}, 0",
                "ja 2b",
                a = in(reg) a,
                b = in(reg) b,
                result = out(reg) result,
            );
        }
    
        result
    }
    • fn multiply(a: usize, b: usize) -> usize {
    • a * b
    • use std::arch::asm;
    • #[cfg(target_arch = "x86_64")]
    • pub fn multiply(a: usize, b: usize) -> usize {
    • let mut result: usize;
    • unsafe {
    • asm!(
    • "mov {result}, 0",
    • "2:",
    • "add {result}, {a}",
    • "dec {b}", // i mean like no ones gonna notice if we modify it :3
    • "cmp {b}, 0",
    • "ja 2b",
    • a = in(reg) a,
    • b = in(reg) b,
    • result = out(reg) result,
    • );
    • }
    • result
    • }