rprlib/analysis/
range.rs

1
2#[derive(Debug, Clone, Copy)]
3pub struct Pointer(pub u32, pub u32);
4
5#[derive(Debug, Clone, Copy)]
6pub struct U32(pub u32, pub u32);
7
8#[derive(Debug, Clone, Copy)]
9pub struct I32(pub i32, pub i32);
10
11#[derive(Debug, Clone, Copy)]
12pub struct F32(pub f32, pub f32);
13
14
15macro_rules! gen_methods {
16    ($t:ident, $it:ident) => {
17        impl $t {
18            pub fn new(i: $it) -> Self {
19                Self(i, i)
20            }
21            pub fn from(a: $it, b: $it) -> Self {
22                Self(a, b)
23            }
24        }
25        
26        impl Default for $t {
27            fn default() -> Self {
28                Self($it::MIN, $it::MAX)
29            }
30        }
31    };
32}
33
34gen_methods!(Pointer, u32);
35gen_methods!(U32, u32);
36gen_methods!(I32, i32);
37gen_methods!(F32, f32);