fn sign_extend(value: u64, mask: u64) -> i64
Convert a u64 to an i64, with sign extension if required.
This is primarily used when needing to treat Value::Generic as a signed value.
Value::Generic