MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / sign_ext

Function sign_ext

crates/virtual-machine/src/cpu/decoder.rs:890–893  ·  view source on GitHub ↗

Sign-extend `val` (a value in the low `bits` bits) to `i64`.

(val: u32, bits: u32)

Source from the content-addressed store, hash-verified

888
889// Sign-extend `val` (a value in the low `bits` bits) to `i64`.
890fn sign_ext(val: u32, bits: u32) -> i64 {
891 let shift = 32 - bits;
892 ((val << shift) as i32 >> shift) as i64
893}
894
895// I-type immediate: bits[31:20], sign-extended to 64 bits.
896fn i_imm(word: u32) -> i64 {

Callers 4

i_immFunction · 0.85
s_immFunction · 0.85
b_immFunction · 0.85
j_immFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected