refactor(ir): use u64 directly instead of spans for instructions
This commit is contained in:
parent
87343f0a38
commit
cdf42417da
3 changed files with 10 additions and 46 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::{num::NonZeroUsize, ops::RangeInclusive};
|
||||
use std::num::NonZeroUsize;
|
||||
|
||||
use instruction::SocketCount;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -268,26 +268,6 @@ impl<'ir> Instruction<'ir> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Some part referred to in source code.
|
||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
pub struct Span {
|
||||
// would love to use an actual [`std::ops::RangeInclusive`], but those don't implement
|
||||
// `PartialOrd` and `Ord` unfortunately
|
||||
/// At which byte this span starts, inclusively.
|
||||
pub from: usize,
|
||||
/// At which byte this span ends, inclusively.
|
||||
pub to: usize,
|
||||
}
|
||||
|
||||
impl From<RangeInclusive<usize>> for Span {
|
||||
fn from(range: RangeInclusive<usize>) -> Self {
|
||||
Self {
|
||||
from: *range.start(),
|
||||
to: *range.end(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Constructs an [`id::Socket`] a bit more tersely.
|
||||
fn socket(id: &id::Instruction, idx: u16) -> id::Socket {
|
||||
id::Socket {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue