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)
| 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. |
| 902 | fn 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. |
| 907 | fn s_imm(word: u32) -> i64 { |