aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jade Philipoom <jadep@google.com>2018-03-06 17:40:55 +0100
committerGravatar jadephilipoom <jade.philipoom@gmail.com>2018-04-03 09:00:55 -0400
commitb8c985c7f281ace8c3ccc47139e0586050c3d87c (patch)
tree4919266f933bb3caa9912c1d2aa6486fe1f24858 /src
parent066d05166ade04f478e793de720de32fd16fe6b8 (diff)
changing Montgomery notations
Diffstat (limited to 'src')
-rw-r--r--src/Experiments/SimplyTypedArithmetic.v13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Experiments/SimplyTypedArithmetic.v b/src/Experiments/SimplyTypedArithmetic.v
index 5577fd21e..ba0b8d34a 100644
--- a/src/Experiments/SimplyTypedArithmetic.v
+++ b/src/Experiments/SimplyTypedArithmetic.v
@@ -8256,14 +8256,19 @@ Module Montgomery256PrintingNotations.
(expr_let n := Z.cast _ @@ (Z.shiftl y @@ x) in f)%expr (at level 40, f at level 200, right associativity, format "'[' 'c.ShiftL(' '$' n ',' x ',' y ');' ']' '//' f") : expr_scope.
Notation "'c.Lower128(' '$' n ',' x ');' f" :=
(expr_let n := Z.cast _ @@ (Z.land 340282366920938463463374607431768211455 @@ x) in f)%expr (at level 40, f at level 200, right associativity, format "'[' 'c.Lower128(' '$' n ',' x ');' ']' '//' f") : expr_scope.
- Notation "'Lower128'"
+ Notation "'c.LowerHalf(' x ')'"
:= (Z.cast uint128 @@ (Z.land 340282366920938463463374607431768211455))
- (at level 10, only printing, format "Lower128")
+ (at level 10, only printing, format "c.LowerHalf( x )")
+ : expr_scope.
+ Notation "'c.UpperHalf(' x ')'"
+ := (Z.cast uint128 @@ (Z.shiftr 340282366920938463463374607431768211455))
+ (at level 10, only printing, format "c.UpperHalf( x )")
: expr_scope.
Notation "( v << count )"
:= (Z.cast _ @@ (Z.shiftl count @@ v)%expr)
(format "( v << count )")
: expr_scope.
+ (*
Notation "( x >> count )"
:= (Z.cast _ @@ (Z.shiftr count @@ x)%expr)
(format "( x >> count )")
@@ -8271,12 +8276,12 @@ Module Montgomery256PrintingNotations.
Notation "x * y"
:= (Z.cast uint256 @@ (Z.mul @@ (x, y)))
: expr_scope.
+ *)
End Montgomery256PrintingNotations.
Import Montgomery256PrintingNotations.
Local Open Scope expr_scope.
-
Print Montgomery256.montred256.
(*
c.ShiftR($x0, $x_lo, 128);
@@ -8311,4 +8316,4 @@ c.Addc($x28, $x_hi, $x26_lo);
c.Selc($x29,RegZero, RegMod);
c.Sub($x30, $x28_lo, $x29);
c.AddM($ret, $x30, RegZero, RegMod);
- *)
+ *) \ No newline at end of file