mirror of
https://gitlab.com/artofrev/smallint.git
synced 2024-12-04 09:01:39 -05:00
improve some variable names
This commit is contained in:
parent
586a0f427e
commit
f890aab454
24
src/logic.rs
24
src/logic.rs
|
@ -7,7 +7,7 @@ use core::ops::{BitAndAssign, BitOrAssign, BitXorAssign};
|
|||
macro_rules! logic_op {
|
||||
(
|
||||
$imp:ident, $imp_assign:ident, $typ:ident, $typ_inner:ident, $fun:ident, $fun_assign:ident;
|
||||
$i:ident, $j:ident, $r:ident, $s:ident;
|
||||
$i:ident, $j:ident, $p:ident, $q:ident, $s:ident, $t:ident;
|
||||
$inline_heap:tt, $heap_heap:tt
|
||||
) => {
|
||||
impl<'a, 'b> $imp<&'a $typ> for &'b $typ {
|
||||
|
@ -19,12 +19,12 @@ macro_rules! logic_op {
|
|||
$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)) => {
|
||||
(&$typ_inner::Inline($i), &$typ_inner::Heap(($p, $s)))
|
||||
| (&$typ_inner::Heap(($p, $s)), &$typ_inner::Inline($i)) => {
|
||||
$inline_heap
|
||||
}
|
||||
|
||||
(&$typ_inner::Heap(($r, $s)), &$typ_inner::Heap(($i, $j))) => {
|
||||
(&$typ_inner::Heap(($p, $s)), &$typ_inner::Heap(($q, $t))) => {
|
||||
$heap_heap
|
||||
}
|
||||
}
|
||||
|
@ -69,20 +69,20 @@ macro_rules! logic_op {
|
|||
};
|
||||
(
|
||||
$imp:ident, $imp_assign:ident, $typ:ident, $typ_inner:ident, $fun:ident, $fun_assign:ident;
|
||||
$i:ident, $j:ident, $r:ident, $s:ident, $slice:ident, $slice1:ident, $slice2:ident, $min:ident, $res:ident;
|
||||
$i:ident, $j:ident, $p:ident, $q:ident, $s:ident, $t:ident, $slice:ident, $slice1:ident, $slice2:ident, $min:ident, $res:ident;
|
||||
$inline_heap_inner:tt, $heap_heap_create_res:tt, $heap_heap_return:tt
|
||||
) => {
|
||||
logic_op! {
|
||||
$imp, $imp_assign, $typ, $typ_inner, $fun, $fun_assign;
|
||||
$i, $j, $r, $s;
|
||||
$i, $j, $p, $q, $s, $t;
|
||||
{
|
||||
let $slice = unsafe { core::slice::from_raw_parts($r, $s) };
|
||||
let $slice = unsafe { core::slice::from_raw_parts($p, $s) };
|
||||
|
||||
$inline_heap_inner
|
||||
},
|
||||
{
|
||||
let $slice1 = unsafe { core::slice::from_raw_parts($r, $s) };
|
||||
let $slice2 = unsafe { core::slice::from_raw_parts($i, $j) };
|
||||
let $slice1 = unsafe { core::slice::from_raw_parts($p, $s) };
|
||||
let $slice2 = unsafe { core::slice::from_raw_parts($q, $t) };
|
||||
|
||||
let $min = std::cmp::min($slice1.len(), $slice2.len());
|
||||
|
||||
|
@ -180,7 +180,7 @@ macro_rules! heap_heap_return_any {
|
|||
|
||||
logic_op! {
|
||||
BitAnd, BitAndAssign, SmallUint, SmallUintType, bitand, bitand_assign;
|
||||
i, j, r, s, slice, slice1, slice2, min, res;
|
||||
i, j, p, q, s, t, slice, slice1, slice2, min, res;
|
||||
{ inline_heap_to_inline! { bitand, SmallUint, SmallUintType; i, slice } },
|
||||
{ heap_heap_create_res_shortest! { bitand; min, slice1, slice2 } },
|
||||
{ heap_heap_return_any! { SmallUint, SmallUintType; res } }
|
||||
|
@ -188,7 +188,7 @@ logic_op! {
|
|||
|
||||
logic_op! {
|
||||
BitOr, BitOrAssign, SmallUint, SmallUintType, bitor, bitor_assign;
|
||||
i, j, r, s, slice, slice1, slice2, min, res;
|
||||
i, j, p, q, s, t, slice, slice1, slice2, min, res;
|
||||
{ inline_heap_to_heap! { bitor_assign, SmallUint, SmallUintType; i, slice } },
|
||||
{ heap_heap_create_res_longest! { bitor; slice1, slice2, min }},
|
||||
{ heap_heap_return_heap! { SmallUint, SmallUintType; res } }
|
||||
|
@ -196,7 +196,7 @@ logic_op! {
|
|||
|
||||
logic_op! {
|
||||
BitXor, BitXorAssign, SmallUint, SmallUintType, bitxor, bitxor_assign;
|
||||
i, j, r, s, slice, slice1, slice2, min, res;
|
||||
i, j, p, q, s, t, slice, slice1, slice2, min, res;
|
||||
{ inline_heap_to_heap! { bitxor_assign, SmallUint, SmallUintType; i, slice } },
|
||||
{ heap_heap_create_res_longest! { bitxor; slice1, slice2, min }},
|
||||
{ heap_heap_return_any! { SmallUint, SmallUintType; res } }
|
||||
|
|
Loading…
Reference in New Issue
Block a user