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

Function u_imm

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

U-type immediate: upper 20 bits placed at [31:12], lower 12 bits zero. We sign-extend from the 32-bit word so that large addresses work correctly.

(word: u32)

Source from the content-addressed store, hash-verified

900// U-type immediate: upper 20 bits placed at [31:12], lower 12 bits zero.
901// We sign-extend from the 32-bit word so that large addresses work correctly.
902fn u_imm(word: u32) -> i64 {
903 (word & 0xFFFF_F000) as i32 as i64
904}
905
906// S-type immediate: bits[31:25] || bits[11:7], sign-extended to 12 bits.
907fn s_imm(word: u32) -> i64 {

Callers 1

decodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected