Skip to main content

sign_extend_to_width

Function sign_extend_to_width 

Source
pub fn sign_extend_to_width(v: i64, width: u32) -> i64
Expand description

Sign-extend the low width bits of a value to a full i64 — a fixed-width datapath’s result register. width >= 64 is the identity; width == 32 reproduces the 32-bit core’s as i32 truncation exactly. The SAME logic yields a 32-, 64-, or any-power-of-two-width core — the toggle.