Split a PC-relative byte offset into (hi20, lo12) for AUIPC+lo pairs.
(offset: i64)
| 312 | |
| 313 | let offset = (target_addr as i64) - (site_local as i64); |
| 314 | if offset & 1 != 0 { |
| 315 | return Err(AssemblerError::new(format!( |
| 316 | "branch to `{target}` has odd offset {offset}" |
| 317 | ))); |
| 318 | } |
| 319 | if !(-4096..=4094).contains(&offset) { |
| 320 | return Err(AssemblerError::new(format!( |
| 321 | "branch to `{target}` offset {offset} out of B-type range [-4096, 4094]" |