1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Addr(usize);
impl fmt::Display for Addr {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}v0", self.0)
}
}
impl Addr {
pub const NULL: Addr = Addr(usize::MAX);
#[cfg(feature = "test-util")]
pub fn from_bits(bits: usize) -> Self {
Addr(bits)
}
#[cfg(not(feature = "test-util"))]
pub(crate) fn from_bits(bits: usize) -> Self {
Addr(bits)
}
pub(crate) fn into_bits(self) -> usize {
self.0
}
}