tree checksum vpatch file

all signers: diana_coman ben_vulpes peterl spyked asciilifeform

antecedents: ffa_ch2_logicals ffa_ch1_genesis ffa_ch4_ffacalc

press order:

ffa_ch1_genesisasciilifeform ben_vulpes diana_coman peterl spyked
ffa_ch2_logicalsasciilifeform ben_vulpes diana_coman peterl spyked
ffa_ch3_shiftsasciilifeform ben_vulpes diana_coman peterl spyked
ffa_ch4_ffacalcasciilifeform ben_vulpes peterl spyked
ffa_ch5_egyptasciilifeform

patch:

- A94FDA8F8E4C698ACDD894F5F7B10D927A4050ABA96096CCB0893B668EA1BA789389B00B62CD997E2617399FA6E2EA969F6ADB4E7BF31C10CC34B74F2E3978DE
+ 38D0D627D069D4DD52809D1D4E1F2BD210EA677D65D87FE64A468A1532841BBEFB472716C12E7F6BB8595914D0A53604CFDBC69A42C408C6A2F3809CC79896D6
ffa/ffacalc/ffa_calc.adb
(32 . 6)(32 . 8)
5 with FZ_Pred; use FZ_Pred;
6 with FZ_BitOp; use FZ_BitOp;
7 with FZ_Shift; use FZ_Shift;
8 with FZ_Divis; use FZ_Divis;
9 with FZ_Mul; use FZ_Mul;
10
11 -- For Output
12 with FFA_IO; use FFA_IO;
(147 . 6)(149 . 15)
14 end Want;
15
16
17 -- Ensure that a divisor is not zero
18 procedure MustNotZero(D : in FZ) is
19 begin
20 if FZ_ZeroP(D) = 1 then
21 E("Division by Zero!");
22 end if;
23 end MustNotZero;
24
25
26 -- Slide a new hex digit into the FZ on top of stack
27 procedure Ins_Hex_Digit(N : in out FZ;
28 D : in Nibble) is
(316 . 6)(327 . 43)
30 Flag := W_NZeroP(F);
31 Drop;
32
33 -- Divide and give Quotient and Remainder
34 when '\' =>
35 Want(2);
36 MustNotZero(Stack(SP));
37 FZ_IDiv(Dividend => Stack(SP - 1),
38 Divisor => Stack(SP),
39 Quotient => Stack(SP - 1),
40 Remainder => Stack(SP));
41
42 -- Divide and give Quotient only
43 when '/' =>
44 Want(2);
45 MustNotZero(Stack(SP));
46 FZ_Div(Dividend => Stack(SP - 1),
47 Divisor => Stack(SP),
48 Quotient => Stack(SP - 1));
49 Drop;
50
51 -- Divide and give Remainder only
52 when '%' =>
53 Want(2);
54 MustNotZero(Stack(SP));
55 FZ_Mod(Dividend => Stack(SP - 1),
56 Divisor => Stack(SP),
57 Remainder => Stack(SP - 1));
58 Drop;
59
60 -- Multiply, give bottom and top halves
61 when '*' =>
62 Want(2);
63 MustNotZero(Stack(SP));
64 -- Ch5: slow and simple 'Egyptological' method:
65 FZ_Mul_Egyptian(X => Stack(SP - 1),
66 Y => Stack(SP),
67 XY_Lo => Stack(SP - 1),
68 XY_Hi => Stack(SP));
69
70 -----------------
71 -- Bitwise Ops --
72 -----------------
- 02733393DEFF85E06F21BF085B23AF379A357CB60143C6EFB6D778B523CA3B4D37E27D9DB625751E0FBE5C811A47E72FC6F3185093D693D7541FD4267CE158C7
+ 7426E4888BF866D3E8B14A4E03A96F4C4CAE79D13F4D6BB5857AEB17B5FEBDC17656AD496C635F9123E0791BA8E18A9E83106900BF817BA582B6A36683474AD3
ffa/libffa/fz_arith.adb
(44 . 6)(44 . 44)
77 pragma Inline_Always(FZ_Add);
78
79
80 -- Gate = 1: Sum := X + Y; Overflow := Carry
81 -- Gate = 0: Sum := X; Overflow := 0
82 procedure FZ_Add_Gated_O(X : in FZ;
83 Y : in FZ;
84 Gate : in WBool;
85 Sum : out FZ;
86 Overflow : out WBool) is
87 Carry : WBool := 0;
88 Mask : constant Word := 0 - Gate;
89 begin
90 for i in 0 .. Word_Index(X'Length - 1) loop
91 declare
92 A : constant Word := X(X'First + i);
93 B : constant Word := Y(Y'First + i) and Mask;
94 S : constant Word := A + B + Carry;
95 begin
96 Sum(Sum'First + i) := S;
97 Carry := W_Carry(A, B, S);
98 end;
99 end loop;
100 Overflow := Carry;
101 end FZ_Add_Gated_O;
102 pragma Inline_Always(FZ_Add_Gated_O);
103
104
105 -- Same as FZ_Add_Gated_O, but without Overflow output
106 procedure FZ_Add_Gated(X : in FZ;
107 Y : in FZ;
108 Gate : in WBool;
109 Sum : out FZ) is
110 Overflow : Word;
111 pragma Unreferenced(Overflow);
112 begin
113 FZ_Add_Gated_O(X, Y, Gate, Sum, Overflow);
114 end FZ_Add_Gated;
115 pragma Inline_Always(FZ_Add_Gated);
116
117
118 -- Difference := X - Y; Underflow := Borrow
119 procedure FZ_Sub(X : in FZ;
120 Y : in FZ;
- 2179915542FA14C44A706F52A9D72556F7085423404304B4C3321B1B5E3E07F1B33674A752D3AAB7EF108C913EF9A93166644DC5692EE766744AC68EB1CEFAAD
+ C00BAEF0B2E192924F96D2B8091D607FC82787D4D6BC97463EDB3A6E317B0292BCB8A0B1F93BC410FECDE02A6763B785503FAB4E6BE4439B8DAD8CEC350F4882
ffa/libffa/fz_arith.ads
(32 . 6)(32 . 22)
125 Overflow : out WBool);
126 pragma Precondition(X'Length = Y'Length and X'Length = Sum'Length);
127
128 -- Gate = 1: Sum := X + Y; Overflow := Carry
129 -- Gate = 0: Sum := X; Overflow := 0
130 procedure FZ_Add_Gated_O(X : in FZ;
131 Y : in FZ;
132 Gate : in WBool;
133 Sum : out FZ;
134 Overflow : out WBool);
135 pragma Precondition(X'Length = Y'Length and X'Length = Sum'Length);
136
137 -- Same as FZ_Add_Gated_O, but without Overflow output
138 procedure FZ_Add_Gated(X : in FZ;
139 Y : in FZ;
140 Gate : in WBool;
141 Sum : out FZ);
142 pragma Precondition(X'Length = Y'Length and X'Length = Sum'Length);
143
144 -- Difference := X - Y; Underflow := Borrow
145 procedure FZ_Sub(X : in FZ;
146 Y : in FZ;
- 9F84B8BAA6EBD696CD3E4C924E7C23404FEA9B5F2B950139B9B133DBB5698B6E3304F0C64E9B4FF639BE287852C88E293074931423CA16259D3C5060F6DA7927
+ 7ED87DF44916CBEF43B37A703F63DBA05BA3C48DB81BF531F195224FC874950430B5603D81595152EC66FD9A36427BC6A02C66323F3F85769E8830604793797D
ffa/libffa/fz_basic.adb
(26 . 6)(26 . 14)
151 -- Fundamental Operations on FZ (finite integers)
152 ---------------------------------------------------------------------------
153
154 -- Determine the Bitness of N
155 function FZ_Bitness(N : in FZ) return Bit_Count is
156 begin
157 return N'Length * Words.Bitness;
158 end FZ_Bitness;
159 pragma Inline_Always(FZ_Bitness);
160
161
162 -- N := 0
163 procedure FZ_Clear(N : out FZ) is
164 begin
- 8AD840A435CBA8610C3E1EEBC5DB1C4C4E59F849B2C7B970A433C21976813C2B854E5D1E056F13CD1066FAF38985BD0FBA1C49AAB873722222AD46942992CB90
+ 25241E9B59D58D8D3A580CF862FF136BE1B02FFD547A943C3E2E7ECFD34D84CD059939253394F400F9E26D5BE1775F73CC755636572332B060137E270C41943A
ffa/libffa/fz_basic.ads
(25 . 6)(25 . 9)
169
170 pragma Pure;
171
172 -- Determine the Bitness of N
173 function FZ_Bitness(N : in FZ) return Bit_Count;
174
175 -- N := 0
176 procedure FZ_Clear(N : out FZ);
177
-
+ A955190427A73C83DD3ABB5CF4F547D6CD29022BF193BFA3403EDF4C227E9917A933C2EEB26C2DCC2DF642292880CDFE051CE21349AFCE656CF9D66CEEE74C7A
ffa/libffa/fz_divis.adb
(0 . 0)(1 . 96)
182 ------------------------------------------------------------------------------
183 ------------------------------------------------------------------------------
184 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
185 -- --
186 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
187 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
188 -- --
189 -- You do not have, nor can you ever acquire the right to use, copy or --
190 -- distribute this software ; Should you use this software for any purpose, --
191 -- or copy and distribute it to anyone or in any manner, you are breaking --
192 -- the laws of whatever soi-disant jurisdiction, and you promise to --
193 -- continue doing so for the indefinite future. In any case, please --
194 -- always : read and understand any software ; verify any PGP signatures --
195 -- that you use - for any purpose. --
196 -- --
197 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
198 ------------------------------------------------------------------------------
199 ------------------------------------------------------------------------------
200
201 with Words; use Words;
202 with W_Pred; use W_Pred;
203 with FZ_Basic; use FZ_Basic;
204 with FZ_Arith; use FZ_Arith;
205 with FZ_BitOp; use FZ_BitOp;
206 with FZ_Shift; use FZ_Shift;
207
208
209 package body FZ_Divis is
210
211 -- Dividend is divided by Divisor, producing Quotient and Remainder.
212 -- WARNING: NO div0 test here! Caller must test.
213 procedure FZ_IDiv(Dividend : in FZ;
214 Divisor : in FZ;
215 Quotient : out FZ;
216 Remainder : out FZ) is
217
218 -- The working register
219 QR : FZ(1 .. Dividend'Length + Divisor'Length);
220
221 -- Bottom seg of Z will end up containing the Quotient; top - remainder
222 Q : FZ renames QR(1 .. Dividend'Length); -- Quotient
223 R : FZ renames QR(Dividend'Length + 1 .. QR'Last); -- Remainder
224
225 C : WBool := 0; -- Borrow, from comparator
226 begin
227 Q := Dividend; -- Q begins with the Dividend
228 FZ_Clear(R); -- R begins empty
229
230 -- For each bit of Dividend:
231 for i in 1 .. FZ_Bitness(Dividend) loop
232
233 -- Advance QR by 1 bit:
234 FZ_ShiftLeft(QR, QR, 1);
235
236 -- Subtract Divisor from R; Underflow goes into C
237 FZ_Sub(X => R, Y => Divisor, Difference => R, Underflow => C);
238
239 -- If C=1, subtraction underflowed, and then Divisor gets added back:
240 FZ_Add_Gated(X => R, Y => Divisor, Gate => C, Sum => R);
241
242 -- Current result-bit is equal to Not-C, i.e. 1 if Divisor 'went in'
243 FZ_Or_W(Q, W_Not(C));
244
245 end loop;
246
247 Quotient := Q; -- Output the Quotient.
248 Remainder := R; -- Output the Remainder.
249
250 end FZ_IDiv;
251 pragma Inline_Always(FZ_IDiv);
252
253
254 -- Exactly same thing as IDiv, but keep only the Quotient
255 procedure FZ_Div(Dividend : in FZ;
256 Divisor : in FZ;
257 Quotient : out FZ) is
258 Remainder : FZ(Divisor'Range);
259 pragma Unreferenced(Remainder);
260 begin
261 FZ_IDiv(Dividend, Divisor, Quotient, Remainder);
262 end FZ_Div;
263 pragma Inline_Always(FZ_Div);
264
265
266 -- Exactly same thing as IDiv, but keep only the Remainder
267 procedure FZ_Mod(Dividend : in FZ;
268 Divisor : in FZ;
269 Remainder : out FZ) is
270 Quotient : FZ(Dividend'Range);
271 pragma Unreferenced(Quotient);
272 begin
273 FZ_IDiv(Dividend, Divisor, Quotient, Remainder);
274 end FZ_Mod;
275 pragma Inline_Always(FZ_Mod);
276
277 end FZ_Divis;
-
+ 9CAF188054443B94A2AC70CB5C344367CBF6450A3D0C590B86275CFEB75A20B862ECA82AC047362D051913C684465C0C32656293FBEFB883DA06F5232F910599
ffa/libffa/fz_divis.ads
(0 . 0)(1 . 51)
282 ------------------------------------------------------------------------------
283 ------------------------------------------------------------------------------
284 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
285 -- --
286 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
287 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
288 -- --
289 -- You do not have, nor can you ever acquire the right to use, copy or --
290 -- distribute this software ; Should you use this software for any purpose, --
291 -- or copy and distribute it to anyone or in any manner, you are breaking --
292 -- the laws of whatever soi-disant jurisdiction, and you promise to --
293 -- continue doing so for the indefinite future. In any case, please --
294 -- always : read and understand any software ; verify any PGP signatures --
295 -- that you use - for any purpose. --
296 -- --
297 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
298 ------------------------------------------------------------------------------
299 ------------------------------------------------------------------------------
300
301 with FZ_Type; use FZ_Type;
302
303
304 package FZ_Divis is
305
306 pragma Pure;
307
308 -- Dividend is divided by Divisor, producing Quotient and Remainder.
309 -- WARNING: NO div0 test here! Caller must test.
310 procedure FZ_IDiv(Dividend : in FZ;
311 Divisor : in FZ;
312 Quotient : out FZ;
313 Remainder : out FZ);
314 pragma Precondition(Dividend'Length = Divisor'Length and
315 Quotient'Length = Remainder'Length and
316 Dividend'Length = Quotient'Length);
317
318 -- Exactly same thing as IDiv, but keep only the Quotient
319 procedure FZ_Div(Dividend : in FZ;
320 Divisor : in FZ;
321 Quotient : out FZ);
322 pragma Precondition(Dividend'Length = Divisor'Length and
323 Dividend'Length = Quotient'Length);
324
325 -- Exactly same thing as IDiv, but keep only the Remainder
326 procedure FZ_Mod(Dividend : in FZ;
327 Divisor : in FZ;
328 Remainder : out FZ);
329 pragma Precondition(Dividend'Length = Divisor'Length and
330 Dividend'Length = Remainder'Length);
331
332 end FZ_Divis;
- CFC75DB07FA645DA2FD4C42CD9923C6EA760D4D0F8182624A91E1B88B2CAB4B7CCB227B371F5F02D46382A9CFF92402A6885F74B0DCB7008196A8A29CD27FA4B
+ 76024B01D3E0EC671B985C2AFFCF0510C4A2DC9667D637111D5BC191678EB6E8A7DA124FBE667A46DB5A6E1E5F4963519D537E3B74C68482F75C9417F692F98E
ffa/libffa/fz_lim.adb
(28 . 9)(28 . 7)
337 -- Supposing we meet the minimal bitness:
338 if B >= FZ_Minimal_Bitness then
339 while T > 0 loop
340 if T mod 2 = 1 then
341 PopCount := PopCount + 1;
342 end if;
343 PopCount := PopCount + T mod 2;
344 T := T / 2;
345 end loop;
346
-
+ ED4F3D12F180E3A39BC7FFC6B17F488F29087C490969A14C9B25C0DD076A8920D0E59F8D0768F433DADE6D0C5CCF1022226F96B54B4EFE1BC7D26B3D5F24EFDA
ffa/libffa/fz_mul.adb
(0 . 0)(1 . 74)
351 ------------------------------------------------------------------------------
352 ------------------------------------------------------------------------------
353 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
354 -- --
355 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
356 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
357 -- --
358 -- You do not have, nor can you ever acquire the right to use, copy or --
359 -- distribute this software ; Should you use this software for any purpose, --
360 -- or copy and distribute it to anyone or in any manner, you are breaking --
361 -- the laws of whatever soi-disant jurisdiction, and you promise to --
362 -- continue doing so for the indefinite future. In any case, please --
363 -- always : read and understand any software ; verify any PGP signatures --
364 -- that you use - for any purpose. --
365 -- --
366 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
367 ------------------------------------------------------------------------------
368 ------------------------------------------------------------------------------
369
370 with Words; use Words;
371 with FZ_Basic; use FZ_Basic;
372 with FZ_Pred; use FZ_Pred;
373 with FZ_Arith; use FZ_Arith;
374 with FZ_Shift; use FZ_Shift;
375
376
377 package body FZ_Mul is
378
379 -- 'Egyptological' multiplier. XY_Lo and XY_Hi hold result of X*Y.
380 procedure FZ_Mul_Egyptian(X : in FZ;
381 Y : in FZ;
382 XY_Lo : out FZ;
383 XY_Hi : out FZ) is
384
385 -- Register holding running product
386 XY : FZ(1 .. X'Length + Y'Length);
387
388 -- X-Slide
389 XS : FZ(1 .. X'Length + Y'Length);
390
391 -- Y-Slide
392 YS : FZ(Y'Range) := Y;
393
394 begin
395 -- Product register begins empty
396 FZ_Clear(XY);
397
398 -- X-Slide initially equals X:
399 XS(1 .. X'Length) := X;
400 XS(X'Length + 1 .. XS'Last) := (others => 0);
401
402 -- For each bit of Y:
403 for i in 1 .. FZ_Bitness(Y) loop
404
405 -- If lowest bit of Y-Slide is 1, X-Slide is added into XY
406 FZ_Add_Gated(X => XY, Y => XS, Sum => XY,
407 Gate => FZ_OddP(YS));
408
409 -- X-Slide := X-Slide * 2
410 FZ_ShiftLeft(XS, XS, 1);
411
412 -- Y-Slide := Y-Slide / 2
413 FZ_ShiftRight(YS, YS, 1);
414
415 end loop;
416
417 -- Write out the Product's lower and upper FZs:
418 XY_Lo := XY(1 .. XY_Lo'Length);
419 XY_Hi := XY(XY_Lo'Length + 1 .. XY'Last);
420
421 end FZ_Mul_Egyptian;
422 pragma Inline_Always(FZ_Mul_Egyptian);
423
424 end FZ_Mul;
-
+ 754392542E46EC3CE2661F8CF10D88AD76DEFE90C0634D885CA6ED8BEB621A96C4ECF7ECCD90BCB168651E60F8A4A431CB9B62D220F4ED61A7D69E94B6B360DA
ffa/libffa/fz_mul.ads
(0 . 0)(1 . 36)
429 ------------------------------------------------------------------------------
430 ------------------------------------------------------------------------------
431 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
432 -- --
433 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
434 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
435 -- --
436 -- You do not have, nor can you ever acquire the right to use, copy or --
437 -- distribute this software ; Should you use this software for any purpose, --
438 -- or copy and distribute it to anyone or in any manner, you are breaking --
439 -- the laws of whatever soi-disant jurisdiction, and you promise to --
440 -- continue doing so for the indefinite future. In any case, please --
441 -- always : read and understand any software ; verify any PGP signatures --
442 -- that you use - for any purpose. --
443 -- --
444 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
445 ------------------------------------------------------------------------------
446 ------------------------------------------------------------------------------
447
448 with FZ_Type; use FZ_Type;
449
450
451 package FZ_Mul is
452
453 pragma Pure;
454
455 -- 'Egyptological' multiplier. XY_Lo and XY_Hi hold result of X*Y.
456 procedure FZ_Mul_Egyptian(X : in FZ;
457 Y : in FZ;
458 XY_Lo : out FZ;
459 XY_Hi : out FZ);
460 pragma Precondition(X'Length = Y'Length and
461 XY_Lo'Length = XY_Hi'Length and
462 XY_Lo'Length = ((X'Length + Y'Length) / 2));
463
464 end FZ_Mul;
- EB4315DC5CBD51BE99AD3575F8A67850C58C642E431DD81369C207D45F248E2590B3BCF7AE77749031B9B5E6C900026B7273ECD858C40CB0D75D18ACC9978E9B
+ AF6A289EF862F6591A5E88F58871447C325476B4E3D89BDB2CB5B2B42A86E0DF35FA3AE85DEBFF1FF89AF69CE60B0839842CB5331B01715671C611B42A92CA6E
ffa/libffa/fz_type.ads
(41 . 6)(41 . 9)
469 -- A count of Words in an FZ (cannot be 0):
470 subtype Word_Count is Indices range 1 .. Indices'Last;
471
472 -- A count of Bits, anywhere (cannot be 0):
473 subtype Bit_Count is Positive;
474
475 -- An index of a particular ~bit~ in an FZ:
476 subtype FZBit_Index is Indices;
477
- C2D77552063FBD97F887509C4EF741B8E3C623C12818C4C4C3CA4D061232F053E254B10ACC4E9E0A9D994F990E4EB13371BA6C61FAD363E8017AF8EF8B829503
+ 3A15947854B3A13A8FBC1CAA660C4FF8FE58D6D1FBDE92D18A7609B96A4C5C8A8CDE444ACF80832C77B32F99A2F8F293478A7873FA5087A4AFBCF8C1889BEAF4
ffa/libffa/w_pred.adb
(38 . 6)(38 . 14)
482 pragma Inline_Always(W_NZeroP);
483
484
485 -- Return WBool-complement of N.
486 function W_Not(N : in WBool) return WBool is
487 begin
488 return 1 xor N;
489 end W_Not;
490 pragma Inline_Always(W_Not);
491
492
493 -- Return 1 if N is odd; otherwise return 0.
494 function W_OddP(N : in Word) return WBool is
495 begin
- 5741DA7808AC201910FABE630437419AF19D3D1F76EE9DE49594A6BED499C84A9D7CFD2491B4A13943B94798DBCFE4F79193559DD3338189ED9CFA281A2FBE2A
+ 8452A69859A3C4FD7E67904FB3505705433E76DEB3E127322B70D5C00E65E5AD32EB3C7636BAF3079948BE424B98F86D4FB2AC2769CC8B982E69D8F58143A0C5
ffa/libffa/w_pred.ads
(30 . 6)(30 . 9)
500 -- Return 1 if N is unequal to 0; otherwise return 0.
501 function W_NZeroP(N : in Word) return WBool;
502
503 -- Return WBool-complement of N.
504 function W_Not(N : in WBool) return WBool;
505
506 -- Return 1 if N is odd; otherwise return 0.
507 function W_OddP(N : in Word) return WBool;
508