tree checksum vpatch file

all signers: asciilifeform ben_vulpes diana_coman peterl spyked

antecedents:

press order:

ffa_ch1_genesisasciilifeform ben_vulpes diana_coman peterl spyked

patch:

-
+ 86525F2C7086039D79E5BF92869D02934A44716812433CA3A90E18A8D03745785C5CA54FE8C39E681B3B13C00C33A5128884A28C8CBACCBC65D0B401D901EC2E
ffa/ffademo/bin/README
(0 . 0)(1 . 1)
5 Placeholder.
-
+ 69D6E455363EA133E472E5F50046E85802CEB0AF29A162D5222F3E57033F359C6FEECBCC2600F527A93E4F749CE7A2C2737C628330A5E994547A16CA2D50E131
ffa/ffademo/demo_ch1.adb
(0 . 0)(1 . 69)
10 ------------------------------------------------------------------------------
11 ------------------------------------------------------------------------------
12 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
13 -- --
14 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
15 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
16 -- --
17 -- You do not have, nor can you ever acquire the right to use, copy or --
18 -- distribute this software ; Should you use this software for any purpose, --
19 -- or copy and distribute it to anyone or in any manner, you are breaking --
20 -- the laws of whatever soi-disant jurisdiction, and you promise to --
21 -- continue doing so for the indefinite future. In any case, please --
22 -- always : read and understand any software ; verify any PGP signatures --
23 -- that you use - for any purpose. --
24 -- --
25 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
26 ------------------------------------------------------------------------------
27 ------------------------------------------------------------------------------
28
29 -- From Ada:
30 with Ada.Text_IO; use Ada.Text_IO;
31
32 -- From FFA:
33 with Words; use Words;
34 with FZ_Type; use FZ_Type;
35 with FZ_Arith; use FZ_Arith;
36
37 -- From the Demo:
38 with FFA_IO; use FFA_IO;
39
40
41 package body Demo_Ch1 is
42
43 procedure Demo_Add_Sub is
44
45 -- We are using 64-bit Words (see iron.ads).
46 -- We'll begin with an elementary demo, using 256-bit FZ:
47 X : FZ(1 .. 4) := (0, 0, 0, 0);
48 Y : FZ(1 .. 4) := (16#5555#, 0, 0, 0);
49 Z : FZ(1 .. 4) := (0, 0, 0, 0);
50
51 -- Carry.
52 C : WBool := 0;
53
54 begin
55
56 Put_Line("X =");
57 Dump(X);
58 New_Line;
59
60 Put_Line("Y =");
61 Dump(Y);
62 New_Line;
63
64 FZ_Add(X, Y, Z, C);
65 Put_Line("X + Y =");
66 Dump(Z);
67 New_Line;
68 Put_Line("C = " & WBool'Image(C));
69
70 FZ_Sub(X, Y, Z, C);
71 Put_Line("X - Y =");
72 Dump(Z);
73 New_Line;
74 Put_Line("C = " & WBool'Image(C));
75
76 end Demo_Add_Sub;
77
78 end Demo_Ch1;
-
+ 65402E9D3BA6968189C5A9D4EC3BE6C58A5582F59B99FA075E3BB561016A3DB29834744EB5C10447F3DDDF74EC056B34E94A4C4878CE0D52D2EDB49703C5BFBD
ffa/ffademo/demo_ch1.ads
(0 . 0)(1 . 24)
83 ------------------------------------------------------------------------------
84 ------------------------------------------------------------------------------
85 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
86 -- --
87 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
88 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
89 -- --
90 -- You do not have, nor can you ever acquire the right to use, copy or --
91 -- distribute this software ; Should you use this software for any purpose, --
92 -- or copy and distribute it to anyone or in any manner, you are breaking --
93 -- the laws of whatever soi-disant jurisdiction, and you promise to --
94 -- continue doing so for the indefinite future. In any case, please --
95 -- always : read and understand any software ; verify any PGP signatures --
96 -- that you use - for any purpose. --
97 -- --
98 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
99 ------------------------------------------------------------------------------
100 ------------------------------------------------------------------------------
101
102 package Demo_Ch1 is
103
104 procedure Demo_Add_Sub;
105
106 end Demo_Ch1;
-
+ F3ED5A695EFB62C72F413C2DF0A763C88A0EDE29BF7DA6217C9FB31B5407CCD0AD69E15E805ADAE3FB36B7A7A1F76BBAF875792C33487C0CD19D8F4A1FCD92DE
ffa/ffademo/ffa_demo.adb
(0 . 0)(1 . 27)
111 ------------------------------------------------------------------------------
112 ------------------------------------------------------------------------------
113 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
114 -- --
115 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
116 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
117 -- --
118 -- You do not have, nor can you ever acquire the right to use, copy or --
119 -- distribute this software ; Should you use this software for any purpose, --
120 -- or copy and distribute it to anyone or in any manner, you are breaking --
121 -- the laws of whatever soi-disant jurisdiction, and you promise to --
122 -- continue doing so for the indefinite future. In any case, please --
123 -- always : read and understand any software ; verify any PGP signatures --
124 -- that you use - for any purpose. --
125 -- --
126 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
127 ------------------------------------------------------------------------------
128 ------------------------------------------------------------------------------
129
130 with Demo_Ch1; use Demo_Ch1;
131
132 procedure FFA_Demo is
133 begin
134
135 Demo_Add_Sub;
136
137 end FFA_Demo;
-
+ 3F71B9BE10609C57FA65C6E889CDD61C09931CB30C1F70619A618BA620B6A74CDCD01D8CC709D1534766ECA3C5C7F1EB91CA2DB2BDF0801A64D68CE41F0061EB
ffa/ffademo/ffa_demo.gpr
(0 . 0)(1 . 69)
142 ------------------------------------------------------------------------------
143 ------------------------------------------------------------------------------
144 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
145 -- --
146 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
147 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
148 -- --
149 -- You do not have, nor can you ever acquire the right to use, copy or --
150 -- distribute this software ; Should you use this software for any purpose, --
151 -- or copy and distribute it to anyone or in any manner, you are breaking --
152 -- the laws of whatever soi-disant jurisdiction, and you promise to --
153 -- continue doing so for the indefinite future. In any case, please --
154 -- always : read and understand any software ; verify any PGP signatures --
155 -- that you use - for any purpose. --
156 -- --
157 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
158 ------------------------------------------------------------------------------
159 ------------------------------------------------------------------------------
160
161 with "../libffa/ffa.gpr";
162
163 project FFA_Demo is
164
165 for Object_Dir use "obj";
166
167 type Mode_Type is ("debug", "release");
168 Mode : Mode_Type := external ("mode", "release");
169
170 for Languages use ("Ada");
171 for Source_Dirs use (".");
172 for Exec_Dir use "bin";
173 for Main use ("ffa_demo.adb");
174
175 package Compiler is
176 case Mode is
177 when "debug" =>
178 for Switches ("Ada")
179 use ("-g");
180 when "release" =>
181 for Switches ("Ada")
182 use ("-O2", "-fdump-scos", "-gnata", "-fstack-check",
183 "-fdata-sections", "-ffunction-sections");
184 end case;
185 end Compiler;
186
187 package Binder is
188 case Mode is
189 when "debug" =>
190 for Switches ("Ada")
191 use ();
192 when "release" =>
193 for Switches ("Ada")
194 use ("-static");
195 end case;
196 end Binder;
197
198 package Linker is
199 case Mode is
200 when "debug" =>
201 for Switches ("Ada")
202 use ();
203 when "release" =>
204 for Switches ("Ada")
205 use ("-Wl,--gc-sections",
206 "-static");
207 end case;
208 end Linker;
209
210 end FFA_Demo;
-
+ 72D041EC18EF96AC552FD25B00BDF114DA2E33FDC50B68D0C7EA32A3887F8DB9E25B1659BAC8225D5708907D752A98325D810A46AE0D3DB05AC841421B9A9CBB
ffa/ffademo/ffa_io.adb
(0 . 0)(1 . 61)
215 ------------------------------------------------------------------------------
216 ------------------------------------------------------------------------------
217 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
218 -- --
219 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
220 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
221 -- --
222 -- You do not have, nor can you ever acquire the right to use, copy or --
223 -- distribute this software ; Should you use this software for any purpose, --
224 -- or copy and distribute it to anyone or in any manner, you are breaking --
225 -- the laws of whatever soi-disant jurisdiction, and you promise to --
226 -- continue doing so for the indefinite future. In any case, please --
227 -- always : read and understand any software ; verify any PGP signatures --
228 -- that you use - for any purpose. --
229 -- --
230 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
231 ------------------------------------------------------------------------------
232 ------------------------------------------------------------------------------
233
234 with Ada.Text_IO; use Ada.Text_IO;
235
236 with Words; use Words;
237 with W_Shifts; use W_Shifts;
238 with FZ_Type; use FZ_Type;
239
240
241 package body FFA_IO is
242
243 -- Obtain the WChars corresponding to the given Word
244 function W_To_WChars(N : Word) return WChars is
245 H : constant array(0 .. 15) of Character := "0123456789ABCDEF";
246 W : Word := N;
247 Result : WChars;
248 begin
249 for b in WChars'Range loop -- From bottom to top:
250 Result(B) := H(Natural(W and 16#F#)); -- Get current nibble.
251 W := Shift_Right(W, 4); -- Get the next nibble.
252 end loop;
253 return Result;
254 end W_To_WChars;
255
256
257 -- Display a hex representation of W to stdout
258 procedure Dump(W : in Word) is
259 T : WChars := W_To_WChars(W);
260 begin
261 for i in reverse T'Range loop
262 Put(T(i));
263 end loop;
264 end Dump;
265
266
267 -- Display a hex representation of N to stdout
268 procedure Dump(N : in FZ) is
269 begin
270 for i in reverse N'Range loop
271 Dump(N(i));
272 end loop;
273 end Dump;
274
275 end FFA_IO;
-
+ 163540113624286EEC3AF83B9B930EA3B01E2E17117A1AD5E07B09E4EB32D00DA4F622C89DFF731C011A947A206FDC8C9F10361F8893BD5F186B2898D3CB567C
ffa/ffademo/ffa_io.ads
(0 . 0)(1 . 37)
280 ------------------------------------------------------------------------------
281 ------------------------------------------------------------------------------
282 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
283 -- --
284 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
285 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
286 -- --
287 -- You do not have, nor can you ever acquire the right to use, copy or --
288 -- distribute this software ; Should you use this software for any purpose, --
289 -- or copy and distribute it to anyone or in any manner, you are breaking --
290 -- the laws of whatever soi-disant jurisdiction, and you promise to --
291 -- continue doing so for the indefinite future. In any case, please --
292 -- always : read and understand any software ; verify any PGP signatures --
293 -- that you use - for any purpose. --
294 -- --
295 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
296 ------------------------------------------------------------------------------
297 ------------------------------------------------------------------------------
298
299 with Words; use Words;
300 with FZ_Type; use FZ_Type;
301
302 package FFA_IO is
303
304 -- Character representation of a Word
305 type WChars is array(1 .. 2 * Byteness) of Character;
306
307 -- Obtain the WChars corresponding to the given Word
308 function W_To_WChars(N : Word) return WChars;
309
310 -- Display a hex representation of W to stdout
311 procedure Dump(W : in Word);
312
313 -- Display a hex representation of N to stdout
314 procedure Dump(N : in FZ);
315
316 end FFA_IO;
-
+ 86525F2C7086039D79E5BF92869D02934A44716812433CA3A90E18A8D03745785C5CA54FE8C39E681B3B13C00C33A5128884A28C8CBACCBC65D0B401D901EC2E
ffa/ffademo/obj/README
(0 . 0)(1 . 1)
321 Placeholder.
-
+ 90AF6E8CA6DF7B67F9644CF403F7884F97B95A17912CE059556A65F46738444761D9ACC7C0A40EC40AD08C5624058127E6DACEB948106630B876BCAE088E1B93
ffa/ffademo/README
(0 . 0)(1 . 47)
326 ------------------------------------------------------------------------------
327 ------------------------------------------------------------------------------
328 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
329 -- --
330 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
331 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
332 -- --
333 -- You do not have, nor can you ever acquire the right to use, copy or --
334 -- distribute this software ; Should you use this software for any purpose, --
335 -- or copy and distribute it to anyone or in any manner, you are breaking --
336 -- the laws of whatever soi-disant jurisdiction, and you promise to --
337 -- continue doing so for the indefinite future. In any case, please --
338 -- always : read and understand any software ; verify any PGP signatures --
339 -- that you use - for any purpose. --
340 -- --
341 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
342 ------------------------------------------------------------------------------
343 ------------------------------------------------------------------------------
344
345 to clean:
346 gprclean
347
348 to build:
349 gprbuild
350
351 to build debug, or on crapple:
352 gprbuild -Xmode=debug
353
354
355 'libffa' will build recursively.
356
357 to run:
358 ./bin/ffa_demo
359
360
361 Chapter 1 demo output should look like this:
362
363 X =
364 0000000000000000000000000000000000000000000000000000000000000000
365 Y =
366 0000000000000000000000000000000000000000000000000000000000005555
367 X + Y =
368 0000000000000000000000000000000000000000000000000000000000005555
369 C = 0
370 X - Y =
371 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFAAAB
372 C = 1
-
+ 803ABED1BF22C6AF82DE99D0A980BB64DF74048896973E69FB314C9BD3B92B9EFCE88BD2BCCBCE5834EB99810E3A3E11B588F2146D07ACE1A54F8C884DEB7572
ffa/libffa/ffa.gpr
(0 . 0)(1 . 62)
377 ------------------------------------------------------------------------------
378 ------------------------------------------------------------------------------
379 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
380 -- --
381 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
382 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
383 -- --
384 -- You do not have, nor can you ever acquire the right to use, copy or --
385 -- distribute this software ; Should you use this software for any purpose, --
386 -- or copy and distribute it to anyone or in any manner, you are breaking --
387 -- the laws of whatever soi-disant jurisdiction, and you promise to --
388 -- continue doing so for the indefinite future. In any case, please --
389 -- always : read and understand any software ; verify any PGP signatures --
390 -- that you use - for any purpose. --
391 -- --
392 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
393 ------------------------------------------------------------------------------
394 ------------------------------------------------------------------------------
395
396 project FFA is
397
398 for Object_Dir use "obj";
399
400 type Mode_Type is ("debug", "release");
401 Mode : Mode_Type := external ("mode", "release");
402
403 for Languages use ("Ada");
404 for Source_Dirs use (".");
405 for Library_Dir use "lib";
406 for Library_Name use "FFA";
407 for Library_Kind use "static";
408
409 package Binder is
410 case Mode is
411 when "debug" =>
412 for Switches ("Ada")
413 use ();
414 when "release" =>
415 for Switches ("Ada")
416 use ("-static", "-r");
417 end case;
418 end Binder;
419
420 package Builder is
421 for Switches ("Ada")
422 use ("-nostdlib");
423 end Builder;
424
425 package Compiler is
426 case Mode is
427 when "debug" =>
428 for Switches ("Ada")
429 use ("-g");
430 when "release" =>
431 for Switches ("Ada")
432 use ("-O2", "-fdump-scos", "-gnata", "-fstack-check",
433 "-fdata-sections", "-ffunction-sections",
434 "-gnatec=" & FFA'Project_Dir & "restrict.adc");
435 end case;
436 end Compiler;
437
438 end FFA;
-
+ 02733393DEFF85E06F21BF085B23AF379A357CB60143C6EFB6D778B523CA3B4D37E27D9DB625751E0FBE5C811A47E72FC6F3185093D693D7541FD4267CE158C7
ffa/libffa/fz_arith.adb
(0 . 0)(1 . 68)
443 ------------------------------------------------------------------------------
444 ------------------------------------------------------------------------------
445 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
446 -- --
447 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
448 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
449 -- --
450 -- You do not have, nor can you ever acquire the right to use, copy or --
451 -- distribute this software ; Should you use this software for any purpose, --
452 -- or copy and distribute it to anyone or in any manner, you are breaking --
453 -- the laws of whatever soi-disant jurisdiction, and you promise to --
454 -- continue doing so for the indefinite future. In any case, please --
455 -- always : read and understand any software ; verify any PGP signatures --
456 -- that you use - for any purpose. --
457 -- --
458 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
459 ------------------------------------------------------------------------------
460 ------------------------------------------------------------------------------
461
462 with Word_Ops; use Word_Ops;
463
464 -- Fundamental Arithmetic operators on FZ:
465 package body FZ_Arith is
466
467 -- Sum := X + Y; Overflow := Carry
468 procedure FZ_Add(X : in FZ;
469 Y : in FZ;
470 Sum : out FZ;
471 Overflow : out WBool) is
472 Carry : WBool := 0;
473 begin
474 for i in X'Range loop
475 declare
476 A : constant Word := X(I);
477 B : constant Word := Y(I);
478 S : constant Word := A + B + Carry;
479 begin
480 Sum(i) := S;
481 Carry := W_Carry(A, B, S);
482 end;
483 end loop;
484 Overflow := Carry;
485 end FZ_Add;
486 pragma Inline_Always(FZ_Add);
487
488
489 -- Difference := X - Y; Underflow := Borrow
490 procedure FZ_Sub(X : in FZ;
491 Y : in FZ;
492 Difference : out FZ;
493 Underflow : out WBool) is
494 Borrow : WBool := 0;
495 begin
496 for i in 0 .. Word_Index(X'Length - 1) loop
497 declare
498 A : constant Word := X(X'First + i);
499 B : constant Word := Y(Y'First + i);
500 S : constant Word := A - B - Borrow;
501 begin
502 Difference(Difference'First + i) := S;
503 Borrow := W_Borrow(A, B, S);
504 end;
505 end loop;
506 Underflow := Borrow;
507 end FZ_Sub;
508 pragma Inline_Always(FZ_Sub);
509
510 end FZ_Arith;
-
+ 2179915542FA14C44A706F52A9D72556F7085423404304B4C3321B1B5E3E07F1B33674A752D3AAB7EF108C913EF9A93166644DC5692EE766744AC68EB1CEFAAD
ffa/libffa/fz_arith.ads
(0 . 0)(1 . 42)
515 ------------------------------------------------------------------------------
516 ------------------------------------------------------------------------------
517 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
518 -- --
519 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
520 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
521 -- --
522 -- You do not have, nor can you ever acquire the right to use, copy or --
523 -- distribute this software ; Should you use this software for any purpose, --
524 -- or copy and distribute it to anyone or in any manner, you are breaking --
525 -- the laws of whatever soi-disant jurisdiction, and you promise to --
526 -- continue doing so for the indefinite future. In any case, please --
527 -- always : read and understand any software ; verify any PGP signatures --
528 -- that you use - for any purpose. --
529 -- --
530 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
531 ------------------------------------------------------------------------------
532 ------------------------------------------------------------------------------
533
534 with Words; use Words;
535 with FZ_Type; use FZ_Type;
536
537 -- Fundamental Arithmetic operators on FZ:
538 package FZ_Arith is
539
540 pragma Pure;
541
542 -- Sum := X + Y; Overflow := Carry
543 procedure FZ_Add(X : in FZ;
544 Y : in FZ;
545 Sum : out FZ;
546 Overflow : out WBool);
547 pragma Precondition(X'Length = Y'Length and X'Length = Sum'Length);
548
549 -- Difference := X - Y; Underflow := Borrow
550 procedure FZ_Sub(X : in FZ;
551 Y : in FZ;
552 Difference : out FZ;
553 Underflow : out WBool);
554 pragma Precondition(X'Length = Y'Length and X'Length = Difference'Length);
555
556 end FZ_Arith;
-
+ EB4315DC5CBD51BE99AD3575F8A67850C58C642E431DD81369C207D45F248E2590B3BCF7AE77749031B9B5E6C900026B7273ECD858C40CB0D75D18ACC9978E9B
ffa/libffa/fz_type.ads
(0 . 0)(1 . 47)
561 ------------------------------------------------------------------------------
562 ------------------------------------------------------------------------------
563 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
564 -- --
565 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
566 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
567 -- --
568 -- You do not have, nor can you ever acquire the right to use, copy or --
569 -- distribute this software ; Should you use this software for any purpose, --
570 -- or copy and distribute it to anyone or in any manner, you are breaking --
571 -- the laws of whatever soi-disant jurisdiction, and you promise to --
572 -- continue doing so for the indefinite future. In any case, please --
573 -- always : read and understand any software ; verify any PGP signatures --
574 -- that you use - for any purpose. --
575 -- --
576 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
577 ------------------------------------------------------------------------------
578 ------------------------------------------------------------------------------
579
580 -- FZ -- the fundamental FZ type: an unsigned integer of fixed width,
581 -- i.e. a contiguous array of machine words. There is no 'meta'-anything:
582 -- in particular, there is no normalization nor will there ever be any
583 -- normalization, nor any provisions for resizing, nor any such thing.
584 -- Note that endianness is irrelevant, here and elsewhere in FFA.
585
586 with Words; use Words;
587
588 package FZ_Type is
589
590 pragma Pure;
591
592 -- Indices of all indexable items:
593 type Indices is new Natural;
594
595 -- Index of a particular Word in an FZ:
596 subtype Word_Index is Indices;
597
598 -- The FZ, in person! I.e. a bignum of permanently fixed bitness.
599 type FZ is array(Word_Index range <>) of Word;
600
601 -- A count of Words in an FZ (cannot be 0):
602 subtype Word_Count is Indices range 1 .. Indices'Last;
603
604 -- An index of a particular ~bit~ in an FZ:
605 subtype FZBit_Index is Indices;
606
607 end FZ_Type;
-
+ B01D6D4E9F150D229D80EA20CD70A84B0A38409A4307CA635874386D40F21E4B3A12B2B1D03C85AFD418C9012427802A818E86EB9B2207CAA2941A346B088EDE
ffa/libffa/iron.ads
(0 . 0)(1 . 41)
612 ------------------------------------------------------------------------------
613 ------------------------------------------------------------------------------
614 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
615 -- --
616 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
617 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
618 -- --
619 -- You do not have, nor can you ever acquire the right to use, copy or --
620 -- distribute this software ; Should you use this software for any purpose, --
621 -- or copy and distribute it to anyone or in any manner, you are breaking --
622 -- the laws of whatever soi-disant jurisdiction, and you promise to --
623 -- continue doing so for the indefinite future. In any case, please --
624 -- always : read and understand any software ; verify any PGP signatures --
625 -- that you use - for any purpose. --
626 -- --
627 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
628 ------------------------------------------------------------------------------
629 ------------------------------------------------------------------------------
630
631 package Iron is
632
633 pragma Pure;
634
635 --------------------------------------
636 -------- For a 64-bit system: --------
637 --------------------------------------
638 MachineBitness : constant Positive := 64;
639 MachineBitnessLog2 : constant Positive := 6; -- log2(64)
640 --------------------------------------
641
642 --------------------------------------
643 -------- For a 32-bit system: --------
644 --------------------------------------
645 -- MachineBitness : constant Positive := 32;
646 -- MachineBitnessLog2 : constant Positive := 5; -- log2(32)
647 --------------------------------------
648
649 -- Bits per Byte
650 ByteBits : constant Positive := 8;
651
652 end Iron;
-
+ 86525F2C7086039D79E5BF92869D02934A44716812433CA3A90E18A8D03745785C5CA54FE8C39E681B3B13C00C33A5128884A28C8CBACCBC65D0B401D901EC2E
ffa/libffa/lib/README
(0 . 0)(1 . 1)
657 Placeholder.
-
+ 86525F2C7086039D79E5BF92869D02934A44716812433CA3A90E18A8D03745785C5CA54FE8C39E681B3B13C00C33A5128884A28C8CBACCBC65D0B401D901EC2E
ffa/libffa/obj/README
(0 . 0)(1 . 1)
662 Placeholder.
-
+ D0AD17F84B1BD83258073C797AC7FA981267777E21F4F11D3292401B2755E5EB28A3A684D65DEC3A6F1B8962E16B79FD3AC013925B516313F993867E6D0237D8
ffa/libffa/README
(0 . 0)(1 . 27)
667 ------------------------------------------------------------------------------
668 ------------------------------------------------------------------------------
669 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
670 -- --
671 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
672 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
673 -- --
674 -- You do not have, nor can you ever acquire the right to use, copy or --
675 -- distribute this software ; Should you use this software for any purpose, --
676 -- or copy and distribute it to anyone or in any manner, you are breaking --
677 -- the laws of whatever soi-disant jurisdiction, and you promise to --
678 -- continue doing so for the indefinite future. In any case, please --
679 -- always : read and understand any software ; verify any PGP signatures --
680 -- that you use - for any purpose. --
681 -- --
682 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
683 ------------------------------------------------------------------------------
684 ------------------------------------------------------------------------------
685
686 to clean:
687 gprclean
688
689 to build:
690 gprbuild
691
692 to build debug, or on crapple:
693 gprbuild -Xmode=debug
-
+ 5ABBDC8789601563EC24D69E2B1354863016FB11B14937B1867BABFDA98DF2622245D3FD065BA5E4C5CCAF7C04BC1A553C0BFFFC2AEFFDA060588E2BC18D3E8C
ffa/libffa/restrict.adc
(0 . 0)(1 . 84)
698 ------------------------------------------------------------------------------
699 ------------------------------------------------------------------------------
700 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
701 -- --
702 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
703 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
704 -- --
705 -- You do not have, nor can you ever acquire the right to use, copy or --
706 -- distribute this software ; Should you use this software for any purpose, --
707 -- or copy and distribute it to anyone or in any manner, you are breaking --
708 -- the laws of whatever soi-disant jurisdiction, and you promise to --
709 -- continue doing so for the indefinite future. In any case, please --
710 -- always : read and understand any software ; verify any PGP signatures --
711 -- that you use - for any purpose. --
712 -- --
713 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
714 ------------------------------------------------------------------------------
715 ------------------------------------------------------------------------------
716
717 pragma Restrictions(Immediate_Reclamation);
718 pragma Restrictions(Max_Asynchronous_Select_Nesting => 0);
719 pragma Restrictions(Max_Protected_Entries => 0);
720 pragma Restrictions(Max_Select_Alternatives => 0);
721 pragma Restrictions(Max_Task_Entries => 0);
722 pragma Restrictions(Max_Tasks => 0);
723 pragma Restrictions(No_Abort_Statements);
724 pragma Restrictions(No_Access_Parameter_Allocators);
725 pragma Restrictions(No_Allocators);
726 pragma Restrictions(No_Asynchronous_Control);
727 pragma Restrictions(No_Calendar);
728 pragma Restrictions(No_Coextensions);
729 pragma Restrictions(No_Default_Stream_Attributes);
730 pragma Restrictions(No_Delay);
731 pragma Restrictions(No_Dispatch);
732 pragma Restrictions(No_Dispatching_Calls);
733 pragma Restrictions(No_Dynamic_Attachment);
734 pragma Restrictions(No_Dynamic_Priorities);
735 pragma Restrictions(No_Entry_Calls_In_Elaboration_Code);
736 pragma Restrictions(No_Entry_Queue);
737 pragma Restrictions(No_Enumeration_Maps);
738 pragma Restrictions(No_Exception_Propagation);
739 pragma Restrictions(No_Exception_Registration);
740 pragma Restrictions(No_Finalization);
741 pragma Restrictions(No_Fixed_Io);
742 pragma Restrictions(No_Floating_Point);
743 pragma Restrictions(No_Implementation_Aspect_Specifications);
744 pragma Restrictions(No_Implementation_Units);
745 pragma Restrictions(No_Implicit_Aliasing);
746 pragma Restrictions(No_Implicit_Conditionals);
747 pragma Restrictions(No_Implicit_Dynamic_Code);
748 pragma Restrictions(No_Implicit_Heap_Allocations);
749 pragma Restrictions(No_Implicit_Protected_Object_Allocations);
750 pragma Restrictions(No_Implicit_Task_Allocations);
751 pragma Restrictions(No_Initialize_Scalars);
752 pragma Restrictions(No_Local_Protected_Objects);
753 pragma Restrictions(No_Local_Timing_Events);
754 pragma Restrictions(No_Multiple_Elaboration);
755 pragma Restrictions(No_Nested_Finalization);
756 pragma Restrictions(No_Protected_Type_Allocators);
757 pragma Restrictions(No_Protected_Types);
758 pragma Restrictions(No_Relative_Delay);
759 pragma Restrictions(No_Requeue_Statements);
760 pragma Restrictions(No_Secondary_Stack);
761 pragma Restrictions(No_Select_Statements);
762 pragma Restrictions(No_Specific_Termination_Handlers);
763 pragma Restrictions(No_Standard_Allocators_After_Elaboration);
764 pragma Restrictions(No_Stream_Optimizations);
765 pragma Restrictions(No_Streams);
766 pragma Restrictions(No_Task_Allocators);
767 pragma Restrictions(No_Task_At_Interrupt_Priority);
768 pragma Restrictions(No_Task_Attributes_Package);
769 pragma Restrictions(No_Task_Hierarchy);
770 pragma Restrictions(No_Tasking);
771 pragma Restrictions(No_Task_Termination);
772 pragma Restrictions(No_Terminate_Alternatives);
773 pragma Restrictions(No_Unchecked_Access);
774 pragma Restrictions(No_Unchecked_Conversion);
775 pragma Restrictions(No_Unchecked_Deallocation);
776 pragma Restrictions(No_Wide_Characters);
777 pragma Restrictions(Pure_Barriers);
778 pragma Restrictions(Simple_Barriers);
779 pragma Restrictions(Static_Priorities);
780 pragma Restrictions(Static_Storage_Size);
781 pragma Validity_Checks(ALL_CHECKS);
-
+ 1041F3065F5E081CB28CF404108DD1E338F5FD262C7658B72D0838F7D7EF6E3457AE941BDD0A19C45B1923B9DA8BCF10DFB2D1B0F1369481410C92411ED3F872
ffa/libffa/word_ops.adb
(0 . 0)(1 . 101)
786 ------------------------------------------------------------------------------
787 ------------------------------------------------------------------------------
788 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
789 -- --
790 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
791 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
792 -- --
793 -- You do not have, nor can you ever acquire the right to use, copy or --
794 -- distribute this software ; Should you use this software for any purpose, --
795 -- or copy and distribute it to anyone or in any manner, you are breaking --
796 -- the laws of whatever soi-disant jurisdiction, and you promise to --
797 -- continue doing so for the indefinite future. In any case, please --
798 -- always : read and understand any software ; verify any PGP signatures --
799 -- that you use - for any purpose. --
800 -- --
801 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
802 ------------------------------------------------------------------------------
803 ------------------------------------------------------------------------------
804
805 with W_Shifts; use W_Shifts;
806
807 -- Fundamental Operations on Words:
808 package body Word_Ops is
809
810 -- Ada (like C) does not (portably) tell us over/underflow from arithmetic.
811 -- And there existed in the past, and apparently exist today, CPUs made
812 -- by idiots and wreckers (e.g. 'RISC-V') that do not have flags at all!
813
814 -- However, for multi-word addition, subtraction, the inner loop of
815 -- Comba's multiplication, and for a handful of other ops, we need it!
816
817 -- So we derive the Carry or Borrow at the 'eldest' binary position.
818 -- See the elementary proof (base case: 1 bit) further below:
819
820 -- Find the Carry, from an addition where it is known that A + B == S:
821 function W_Carry(A : in Word; B : in Word; S : in Word)
822 return WBool is
823 begin
824 return WBool(Shift_Right((A and B) or ((A or B) and (not S)),
825 Bitness - 1));
826 end W_Carry;
827 pragma Inline_Always(W_Carry);
828
829
830 -- Find the Borrow, from a subtraction where it is known that A - B == D:
831 function W_Borrow(A : in Word; B : in Word; D : in Word)
832 return WBool is
833 begin
834 return WBool(Shift_Right(((not A) and B) or (((not A) or B) and D),
835 Bitness - 1));
836 end W_Borrow;
837 pragma Inline_Always(W_Borrow);
838
839 -- A+B+C is the output bit of 1-bit adder; C is carry-in;
840 -- A-B-C is the output bit of 1-bit subber; C is borrow-in.
841 -- Observe that A+B+C is equal to A-B-C for all A,B,C !
842 -- +-+-+-+-----+--------------+-----+----------------+
843 -- | | 'Carry' out: | | 'Borrow' out: |
844 -- +-+-+-+-----+--------------+-----+----------------+
845 -- | | | | |(a and b) or | |(~a and b) or |
846 -- |A|B|C|A+B+C| ((a or b) and|A-B-C| ((~a or b) and |
847 -- | | | | | ~(A+B+C)) | | (A-B-C)) |
848 -- +-+-+-+-----+--------------+-----+----------------+
849 -- |0|0|0| 0 | 0 | 0 | 0 |
850 -- +-+-+-+-----+--------------+-----+----------------+
851 -- |1|0|0| 1 | 0 | 1 | 0 |
852 -- +-+-+-+-----+--------------+-----+----------------+
853 -- |0|1|0| 1 | 0 | 1 | 1 |
854 -- +-+-+-+-----+--------------+-----+----------------+
855 -- |1|1|0| 0 | 1 | 0 | 0 |
856 -- +-+-+-+-----+--------------+-----+----------------+
857 -- |0|0|1| 1 | 0 | 1 | 1 |
858 -- +-+-+-+-----+--------------+-----+----------------+
859 -- |1|0|1| 0 | 1 | 0 | 0 |
860 -- +-+-+-+-----+--------------+-----+----------------+
861 -- |0|1|1| 0 | 1 | 0 | 1 |
862 -- +-+-+-+-----+--------------+-----+----------------+
863 -- |1|1|1| 1 | 1 | 1 | 1 |
864 -- +-+-+-+-----+--------------+-----+----------------+
865 -- This base case extends to any N bit register, since
866 -- both equations depend ~strictly~ on A, B, and C.
867
868
869 -- Without any branching: if Sel == 0, return A; if Sel == 1, return B.
870 function W_Mux(A : in Word; B : in Word; Sel : in WBool) return Word is
871 begin
872 return B xor ((Sel - 1) and (A xor B));
873 end W_Mux;
874 pragma Inline_Always(W_Mux);
875
876
877 -- Exchange A and B.
878 procedure W_Swap(A : in out Word; B : in out Word) is
879 begin
880 A := A xor B;
881 B := A xor B;
882 A := A xor B;
883 end W_Swap;
884 pragma Inline_Always(W_Swap);
885
886 end Word_Ops;
-
+ A470D0A28ADB230224904DE97B8D55E040B0DE121ED5CB62B4FE23AF6E1CC7EE08DDA2B69BCAA909E0E951BEC159DAD74D378A14E438CD713937BFB4B5183FA7
ffa/libffa/word_ops.ads
(0 . 0)(1 . 42)
891 ------------------------------------------------------------------------------
892 ------------------------------------------------------------------------------
893 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
894 -- --
895 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
896 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
897 -- --
898 -- You do not have, nor can you ever acquire the right to use, copy or --
899 -- distribute this software ; Should you use this software for any purpose, --
900 -- or copy and distribute it to anyone or in any manner, you are breaking --
901 -- the laws of whatever soi-disant jurisdiction, and you promise to --
902 -- continue doing so for the indefinite future. In any case, please --
903 -- always : read and understand any software ; verify any PGP signatures --
904 -- that you use - for any purpose. --
905 -- --
906 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
907 ------------------------------------------------------------------------------
908 ------------------------------------------------------------------------------
909
910 with Words; use Words;
911
912 -- Fundamental Operations on Words:
913 package Word_Ops is
914
915 pragma Pure;
916
917 -- Branch-free calculation of 'carry' from a machine-word addition.
918 function W_Carry(A : in Word; B : in Word; S : in Word)
919 return WBool;
920
921 -- Branch-free calculation of 'borrow' from a machine-word subtraction.
922 function W_Borrow(A : in Word; B : in Word; D : in Word)
923 return WBool;
924
925 -- Without any branching: if Sel == 0, return A; if Sel == 1, return B.
926 function W_Mux(A : in Word; B : in Word; Sel : in WBool)
927 return Word;
928
929 -- Exchange A and B.
930 procedure W_Swap(A : in out Word; B : in out Word);
931
932 end Word_Ops;
-
+ C7AAA6FDFE19A3D3398D793E14264B1B3C2A3FE165D388243BE34E378CDA3162110F9F0AAE70692505A3E162C0491DF1532BC90D0F2D109655FD67441C418C24
ffa/libffa/words.ads
(0 . 0)(1 . 46)
937 ------------------------------------------------------------------------------
938 ------------------------------------------------------------------------------
939 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
940 -- --
941 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
942 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
943 -- --
944 -- You do not have, nor can you ever acquire the right to use, copy or --
945 -- distribute this software ; Should you use this software for any purpose, --
946 -- or copy and distribute it to anyone or in any manner, you are breaking --
947 -- the laws of whatever soi-disant jurisdiction, and you promise to --
948 -- continue doing so for the indefinite future. In any case, please --
949 -- always : read and understand any software ; verify any PGP signatures --
950 -- that you use - for any purpose. --
951 -- --
952 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
953 ------------------------------------------------------------------------------
954 ------------------------------------------------------------------------------
955
956 with Iron;
957
958 package Words is
959
960 pragma Pure;
961
962 -- The most fundamental fact about Word: width.
963 Bitness : constant Positive := Iron.MachineBitness;
964
965 -- It is possible to calculate BitnessLog2 at elaboration time,
966 -- but we will avoid having ~any~ elaboration at all in FFA.
967 BitnessLog2 : constant Positive := Iron.MachineBitnessLog2;
968
969 -- The Word width, expressed in ~bytes~:
970 Byteness : constant Positive := Bitness / Iron.ByteBits;
971
972 -- What kind of words to use. Must be machine-word or smaller.
973 type Word is mod 2**Bitness;
974 for Word'Size use Bitness;
975
976 -- The very same Word, but its only legal values are 0 and 1.
977 subtype WBool is Word range 0 .. 1;
978
979 -- When we must refer to individual bit positions of a machine word:
980 subtype WBit_Index is Natural range 0 .. Bitness - 1;
981
982 end Words;
-
+ A869EF469C2EE3E903B9FFAC042E3E325CABFD4F51854D50661C492F0556681DDF3EEF567D6502239F2F0F131B999F1E6EDCF39A6E12D93DBE08872DF7F4CF5A
ffa/libffa/w_shifts.ads
(0 . 0)(1 . 58)
987 ------------------------------------------------------------------------------
988 ------------------------------------------------------------------------------
989 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
990 -- --
991 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
992 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
993 -- --
994 -- You do not have, nor can you ever acquire the right to use, copy or --
995 -- distribute this software ; Should you use this software for any purpose, --
996 -- or copy and distribute it to anyone or in any manner, you are breaking --
997 -- the laws of whatever soi-disant jurisdiction, and you promise to --
998 -- continue doing so for the indefinite future. In any case, please --
999 -- always : read and understand any software ; verify any PGP signatures --
1000 -- that you use - for any purpose. --
1001 -- --
1002 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
1003 ------------------------------------------------------------------------------
1004 ------------------------------------------------------------------------------
1005
1006 with Words; use Words;
1007
1008 -- For some peculiar reason, the Ada standards group made
1009 -- the fundamental Shift and Rotate bitwise ops into ~optional~ components!
1010
1011 -- However on GNAT we can force them to exist, as described in:
1012 -- https://gcc.gnu.org/onlinedocs/gnat_rm/Shifts-and-Rotates.html
1013
1014 -- On a non-GNAT compiler, you're own your own.
1015
1016 package W_Shifts is
1017
1018 pragma Pure;
1019
1020 function Shift_Left
1021 (Value : Word;
1022 Amount : Natural)
1023 return Word;
1024 pragma Import(Intrinsic, Shift_Left);
1025
1026 function Shift_Right
1027 (Value : Word;
1028 Amount : Natural)
1029 return Word;
1030 pragma Import(Intrinsic, Shift_Right);
1031
1032 function Rotate_Left
1033 (Value : Word;
1034 Amount : Natural)
1035 return Word;
1036 pragma Import(Intrinsic, Rotate_Left);
1037
1038 function Rotate_Right
1039 (Value : Word;
1040 Amount : Natural)
1041 return Word;
1042 pragma Import(Intrinsic, Rotate_Right);
1043
1044 end W_Shifts;
-
+ C146B4FA50A8C6493C149914F2528FCB7106FC09E5C335D528D6D227FDE0577DECEB452424F1ACD6573F070F262D54427606DCE6C6332930DE970A82CEB28472
ffa/README
(0 . 0)(1 . 27)
1049 ------------------------------------------------------------------------------
1050 ------------------------------------------------------------------------------
1051 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
1052 -- --
1053 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
1054 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
1055 -- --
1056 -- You do not have, nor can you ever acquire the right to use, copy or --
1057 -- distribute this software ; Should you use this software for any purpose, --
1058 -- or copy and distribute it to anyone or in any manner, you are breaking --
1059 -- the laws of whatever soi-disant jurisdiction, and you promise to --
1060 -- continue doing so for the indefinite future. In any case, please --
1061 -- always : read and understand any software ; verify any PGP signatures --
1062 -- that you use - for any purpose. --
1063 -- --
1064 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
1065 ------------------------------------------------------------------------------
1066 ------------------------------------------------------------------------------
1067
1068 See contents of 'demo'.
1069
1070
1071 Questions?
1072
1073 http://webchat.freenode.net/?channels=#trilema&nick=from_ffa
1074
1075 Privmsg one of the people speaking and ask politely for 'voice'.