pub(crate) fn extend_sign(val: u64, nbytes: usize) -> i64