Skip to main content

sign_extend

Function sign_extend 

Source
pub fn sign_extend(value: u64, n: usize) -> u64
Expand description

Sign-extend a value from n bytes to 64 bits (eq A.16: Xₙ).

X_n(x) = x + floor(x / 2^(8n-1)) * (2^64 - 2^(8n))