mirror of
https://gitlab.com/artofrev/smallint.git
synced 2024-12-04 17:11:38 -05:00
eliminate free function
This commit is contained in:
parent
06ce35aa69
commit
96f7b1a5ef
32
src/logic.rs
32
src/logic.rs
|
@ -10,28 +10,24 @@ macro_rules! logic_op {
|
||||||
$i:ident, $j:ident, $r:ident, $s:ident;
|
$i:ident, $j:ident, $r:ident, $s:ident;
|
||||||
$inline_heap:tt, $heap_heap:tt
|
$inline_heap:tt, $heap_heap:tt
|
||||||
) => {
|
) => {
|
||||||
fn $fun(a: &$typ, b: &$typ) -> $typ {
|
|
||||||
match (&a.0, &b.0) {
|
|
||||||
(&$typ_inner::Inline($i), &$typ_inner::Inline($j)) => {
|
|
||||||
$typ($typ_inner::Inline($i.$fun($j)))
|
|
||||||
}
|
|
||||||
|
|
||||||
(&$typ_inner::Inline($i), &$typ_inner::Heap(($r, $s)))
|
|
||||||
| (&$typ_inner::Heap(($r, $s)), &$typ_inner::Inline($i)) => {
|
|
||||||
$inline_heap
|
|
||||||
}
|
|
||||||
|
|
||||||
(&$typ_inner::Heap(($r, $s)), &$typ_inner::Heap(($i, $j))) => {
|
|
||||||
$heap_heap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a, 'b> $imp<&'a $typ> for &'b $typ {
|
impl<'a, 'b> $imp<&'a $typ> for &'b $typ {
|
||||||
type Output = $typ;
|
type Output = $typ;
|
||||||
|
|
||||||
fn $fun(self, rhs: &$typ) -> Self::Output {
|
fn $fun(self, rhs: &$typ) -> Self::Output {
|
||||||
$fun(self, rhs)
|
match (&self.0, &rhs.0) {
|
||||||
|
(&$typ_inner::Inline($i), &$typ_inner::Inline($j)) => {
|
||||||
|
$typ($typ_inner::Inline($i.$fun($j)))
|
||||||
|
}
|
||||||
|
|
||||||
|
(&$typ_inner::Inline($i), &$typ_inner::Heap(($r, $s)))
|
||||||
|
| (&$typ_inner::Heap(($r, $s)), &$typ_inner::Inline($i)) => {
|
||||||
|
$inline_heap
|
||||||
|
}
|
||||||
|
|
||||||
|
(&$typ_inner::Heap(($r, $s)), &$typ_inner::Heap(($i, $j))) => {
|
||||||
|
$heap_heap
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user