| 1 |
From Coq Require Import ZArith. |
| 2 |
Require Import Crypto.Util.ZUtil.Testbit. |
| 3 |
Require Import Crypto.Util.ZUtil.Hints.Core. |
| 4 |
|
| 5 |
Ltac Ztestbit_full_step := |
| 6 |
match goal with |
| 7 |
| _ => progress autorewrite with Ztestbit_full |
| 8 |
| [ |- context[Z.testbit ?x ?y] ] |
| 9 |
=> rewrite (Z.testbit_neg_r x y) by zutil_arith |
| 10 |
| [ |- context[Z.testbit ?x ?y] ] |
| 11 |
=> rewrite (Z.bits_above_pow2 x y) by zutil_arith |
| 12 |
| [ |- context[Z.testbit ?x ?y] ] |
| 13 |
=> rewrite (Z.bits_above_log2 x y) by zutil_arith |
| 14 |
end. |
| 15 |
Ltac Ztestbit_full := repeat Ztestbit_full_step. |
| 16 |
|
| 17 |
Ltac Ztestbit_step := |
| 18 |
match goal with |
| 19 |
| _ => progress autorewrite with Ztestbit |
| 20 |
| _ => progress Ztestbit_full_step |
| 21 |
end. |
| 22 |
Ltac Ztestbit := repeat Ztestbit_step. |