- C6CE2B2EFEC9BF6172130008C0EA7703D08D07862296A2CA5B1D790352697C3E05D2D233BFCF3F533164E45027A9BFA2815445FDB1E75807F5092335F99B03A4+ 0DC7983700B4D2EEC0CD0FE41D7BE166568CAF3BEE53D635CAB6685A0FBFC4057AB6B5836A3CD74AC152973A4A6CBBCFE4C8A514942E03F3591DCD811C8D1AA2ffa/ffacalc/ffa_calc.adb(2 . 7)(2 . 7)
61 ------------------------------------------------------------------------------
62 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
63 -- --
64 -- (C) 2018 Stanislav Datskovskiy ( www.loper-os.org ) --
65 -- (C) 2019 Stanislav Datskovskiy ( www.loper-os.org ) --
66 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
67 -- --
68 -- You do not have, nor can you ever acquire the right to use, copy or --
(393 . 6)(393 . 27)
70 XY_Lo => Stack(SP - 1),
71 XY_Hi => Stack(SP));
72
73 -- Square, give bottom and top halves
74 when 'S' =>
75 Want(1);
76 Push;
77 FFA_FZ_Square(X => Stack(SP - 1),
78 XX_Lo => Stack(SP - 1),
79 XX_Hi => Stack(SP));
80
81 -- Greatest Common Divisor (GCD)
82 when 'G' =>
83 Want(2);
84
85 -- Note that GCD(0,0) is not factually zero, or unique.
86 -- But it is permissible to define it as zero.
87 -- (See Ch. 15 discussion.)
88
89 FFA_FZ_Greatest_Common_Divisor(X => Stack(SP - 1),
90 Y => Stack(SP),
91 Result => Stack(SP - 1));
92 Drop;
93
94 -----------------
95 -- Bitwise Ops --
96 -----------------
(492 . 14)(513 . 6)
98 FFA_FZ_Clear(Stack(SP));
99 FFA_FZ_Set_Head(Stack(SP), Word(FFA_K_Version));
100
101 -- Square, give bottom and top halves
102 when 'S' =>
103 Want(1);
104 Push;
105 FFA_FZ_Square(X => Stack(SP - 1),
106 XX_Lo => Stack(SP - 1),
107 XX_Hi => Stack(SP));
108
109 --------------
110 -- Prefixes --
111 --------------
(520 . 7)(533 . 7)
113 -- Reserved Ops, i.e. ones we have not defined yet: --
114 ---------------------------------------------------------
115 when '!' | '@' | '$' | ':' | ';' | ',' |
116 'G' | 'H' | 'I' | 'J' | 'K' | 'N' |
117 'H' | 'I' | 'J' | 'K' | 'N' |
118 'P' | 'T' | 'X' | 'Y' =>
119
120 E("This Operator is not defined yet: " & C);
(602 . 19)(615 . 27)
122 when 'R' =>
123 E("Right-Rotate not yet defined!");
124
125 -- 'Right-Multiply', give only lower half of the product XY
126 when '*' =>
127 Want(2);
128 FFA_FZ_Low_Multiply(X => Stack(SP - 1),
129 Y => Stack(SP),
130 XY => Stack(SP - 1));
131 Drop;
132
133 -- ... Unknown:
134 when others =>
135 E("Undefined Op: R" & O);
136
137 end case;
138 ---------------------------------------------------------
139 -- Modular...
140 -- Modular...
141 when 'M' =>
142
143 -- Which M-op?
144 case O is
145
146 -- ... Multiplication :
147 -- ... Multiplication (Conventional) :
148 when '*' =>
149 Want(3);
150 MustNotZero(Stack(SP));
(625 . 7)(646 . 16)
152 Drop;
153 Drop;
154
155 -- ... Exponentiation :
156 -- ... Squaring (Conventional) :
157 when 'S' =>
158 Want(2);
159 MustNotZero(Stack(SP));
160 FFA_FZ_Modular_Square(X => Stack(SP - 1),
161 Modulus => Stack(SP),
162 Product => Stack(SP - 1));
163 Drop;
164
165 -- ... Exponentiation (Barrettronic) :
166 when 'X' =>
167 Want(3);
168 MustNotZero(Stack(SP));