use (isub 1 $C) instead (iadd -1 $C)
This commit is contained in:
@@ -195,4 +195,4 @@
|
|||||||
;; Reminder by a power of two -> bitwise and with decreased by one constant.
|
;; Reminder by a power of two -> bitwise and with decreased by one constant.
|
||||||
(=> (when (urem_imm $C $x)
|
(=> (when (urem_imm $C $x)
|
||||||
(is-power-of-two $C))
|
(is-power-of-two $C))
|
||||||
(band_imm $(iadd -1 $C) $x))
|
(band_imm $(isub 1 $C) $x))
|
||||||
Binary file not shown.
@@ -233,6 +233,10 @@ pub enum UnquoteOperator {
|
|||||||
#[peepmatic(params(iNN, iNN), result(iNN))]
|
#[peepmatic(params(iNN, iNN), result(iNN))]
|
||||||
Iadd,
|
Iadd,
|
||||||
|
|
||||||
|
/// Compile-time `iadd` of two constant values.
|
||||||
|
#[peepmatic(params(iNN, iNN), result(iNN))]
|
||||||
|
Isub,
|
||||||
|
|
||||||
/// Compile-time `imul` of two constant values.
|
/// Compile-time `imul` of two constant values.
|
||||||
#[peepmatic(params(iNN, iNN), result(iNN))]
|
#[peepmatic(params(iNN, iNN), result(iNN))]
|
||||||
Imul,
|
Imul,
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ where
|
|||||||
| UnquoteOperator::Bor
|
| UnquoteOperator::Bor
|
||||||
| UnquoteOperator::Bxor
|
| UnquoteOperator::Bxor
|
||||||
| UnquoteOperator::Iadd
|
| UnquoteOperator::Iadd
|
||||||
|
| UnquoteOperator::Isub
|
||||||
| UnquoteOperator::Imul => unreachable!("not a unary unquote operator: {:?}", operator),
|
| UnquoteOperator::Imul => unreachable!("not a unary unquote operator: {:?}", operator),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -98,6 +99,7 @@ where
|
|||||||
UnquoteOperator::Bor => fold_ints!(a, b, |x, y| x | y),
|
UnquoteOperator::Bor => fold_ints!(a, b, |x, y| x | y),
|
||||||
UnquoteOperator::Bxor => fold_ints!(a, b, |x, y| x ^ y),
|
UnquoteOperator::Bxor => fold_ints!(a, b, |x, y| x ^ y),
|
||||||
UnquoteOperator::Iadd => fold_ints!(a, b, |x, y| x.wrapping_add(y)),
|
UnquoteOperator::Iadd => fold_ints!(a, b, |x, y| x.wrapping_add(y)),
|
||||||
|
UnquoteOperator::Isub => fold_ints!(a, b, |x, y| x.wrapping_sub(y)),
|
||||||
UnquoteOperator::Imul => fold_ints!(a, b, |x, y| x.wrapping_mul(y)),
|
UnquoteOperator::Imul => fold_ints!(a, b, |x, y| x.wrapping_mul(y)),
|
||||||
UnquoteOperator::Log2 | UnquoteOperator::Neg => {
|
UnquoteOperator::Log2 | UnquoteOperator::Neg => {
|
||||||
unreachable!("not a binary unquote operator: {:?}", operator)
|
unreachable!("not a binary unquote operator: {:?}", operator)
|
||||||
|
|||||||
Reference in New Issue
Block a user