tree checksum vpatch file split hunks

all signers: asciilifeform bvt diana_coman

antecedents: ffa_ch1_genesis.kv

press order:

ffa_ch1_genesis.kvasciilifeform bvt diana_coman
ffa_ch2_logicals.kvasciilifeform bvt diana_coman

patch:

- 33552678F5519339C5BEAEC7C62A4F43D2D32FF9620090A6866C056A13C369EE4689263C306102D675622EF9742FA3943698533C3A6407A65EC6036992E8DF96
+ 88D2C0487E367264F3B1F041CE0C0F95656350824F39B69C86168F45DF4F8E4C1626D44C49AA2434460EC62B399867E5E11225383E26F7421A33D51BCA0B3524
ffa/README
(19 . 6)(19 . 7)
5
6 See contents of 'demo'.
7
8 See also project WWW: http://www.loper-os.org/?cat=49
9
10 Questions?
11
- 5220F733B82ACDCD95B2806401322ED4657325E6D3D4F1264CFD390C304B900F6A8B1555EB48DDD966ECE7EF91BD120E54972873817A8E8E94B84BD62DD7196A
+ 20E5FD1DB56FBEDCCAD21587FE6D6AD44C6D7208CD5632A12E364B81217ACF68B1B92BC1D82E29E5C16E6CAEBB5B8DCE8C275A2E21691F5B355314B0AAC2BE7D
ffa/ffademo/demo_ch1.adb
(43 . 6)(43 . 8)
16 C : WBool := 0;
17
18 begin
19 Put_Line("~~~ Ch. 1 : Add, Sub ~~~");
20 New_Line;
21
22 Put_Line("X =");
23 Dump(X);
(63 . 6)(65 . 7)
25 Dump(Z);
26 New_Line;
27 Put_Line("C = " & WBool'Image(C));
28 New_Line;
29
30 end Demo_Add_Sub;
31
-
+ AB686F59589863AB3EFE9E97C9AE2ECC3BE0D3457D010326AFFFEACA6FF42A662F1B05FEB8C08492EF77392EDDE5ABF26E8EE6CABC75BC0F2391663AE77EBB16
ffa/ffademo/demo_ch2.adb
(0 . 0)(1 . 236)
36 ------------------------------------------------------------------------------
37 ------------------------------------------------------------------------------
38 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
39 -- --
40 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
41 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
42 -- --
43 -- You do not have, nor can you ever acquire the right to use, copy or --
44 -- distribute this software ; Should you use this software for any purpose, --
45 -- or copy and distribute it to anyone or in any manner, you are breaking --
46 -- the laws of whatever soi-disant jurisdiction, and you promise to --
47 -- continue doing so for the indefinite future. In any case, please --
48 -- always : read and understand any software ; verify any PGP signatures --
49 -- that you use - for any purpose. --
50 -- --
51 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
52 ------------------------------------------------------------------------------
53 ------------------------------------------------------------------------------
54
55 -- From Ada:
56 with Ada.Text_IO; use Ada.Text_IO;
57
58 -- From FFA:
59 with Words; use Words;
60 with FZ_Type; use FZ_Type;
61 with FZ_Arith; use FZ_Arith;
62
63 -- FFA Ch. 2
64 with W_Pred; use W_Pred;
65 with FZ_Basic; use FZ_Basic;
66 with FZ_Pred; use FZ_Pred;
67 with FZ_BitOp; use FZ_BitOp;
68 with FZ_Cmp; use FZ_Cmp;
69
70 -- From the Demo:
71 with FFA_IO; use FFA_IO;
72
73
74 package body Demo_Ch2 is
75
76 procedure Demo_Word_Preds is
77
78 begin
79
80 Put_Line("~~~ Ch. 2 : Word Predicates ~~~");
81 New_Line;
82
83 Put_Line("W_ZeroP(0) :");
84 Dump(W_ZeroP(0));
85 New_Line;
86 New_Line;
87
88 Put_Line("W_ZeroP(1) :");
89 Dump(W_ZeroP(1));
90 New_Line;
91 New_Line;
92
93 Put_Line("W_NZeroP(1) :");
94 Dump(W_NZeroP(1));
95 New_Line;
96 New_Line;
97
98 Put_Line("W_OddP(3) :");
99 Dump(W_OddP(3));
100 New_Line;
101 New_Line;
102
103 Put_Line("W_EqP(1, 1) :");
104 Dump(W_EqP(1, 1));
105 New_Line;
106 New_Line;
107
108 Put_Line("W_EqP(1, 0) :");
109 Dump(W_EqP(1, 0));
110 New_Line;
111 New_Line;
112
113 end Demo_Word_Preds;
114
115
116 procedure Demo_FZ_Basics is
117
118 X : FZ(1 .. 4) := ( 0, 0, 0, 0);
119
120 -- Shorthand for 'maxint'
121 Y : FZ(1 .. 4) := (-1, -1, -1, -1);
122
123 Z : FZ(1 .. 4) := ( 0, 0, 0, 0);
124
125 -- Flag.
126 F : WBool := 0;
127
128 begin
129
130 Put_Line("~~~ Ch. 2 : FZ Basics ~~~");
131 New_Line;
132
133 Put_Line("X =");
134 Dump(X);
135 New_Line;
136 New_Line;
137
138 Put_Line("Y =");
139 Dump(Y);
140 New_Line;
141 New_Line;
142
143 Put_Line("FZ_ZeroP(X) :");
144 Dump(FZ_ZeroP(X));
145 New_Line;
146 New_Line;
147
148 Put_Line("FZ_ZeroP(Y) :");
149 Dump(FZ_ZeroP(Y));
150 New_Line;
151 New_Line;
152
153 FZ_Swap(X, Y);
154 Put_Line("After FZ_Swap(X, Y) :");
155 Put_Line("X =");
156 Dump(X);
157 New_Line;
158 New_Line;
159
160 Put_Line("Y =");
161 Dump(Y);
162 New_Line;
163 New_Line;
164
165 F := 0;
166 FZ_Mux(X, Y, Z, F);
167 Put_Line("After F := 0 , FZ_Mux(X, Y, Z, F) : ");
168 Put_Line("Z =");
169 Dump(Z);
170 New_Line;
171 New_Line;
172
173 F := 1;
174 FZ_Mux(X, Y, Z, F);
175 Put_Line("After F := 1 , FZ_Mux(X, Y, Z, F) : ");
176 Put_Line("Z =");
177 Dump(Z);
178 New_Line;
179 New_Line;
180
181 end Demo_FZ_Basics;
182
183
184 procedure Demo_FZ_Various_Ops is
185
186 X : FZ(1 .. 4) := ( 16#083e16f27091f65f#, 16#74c01a9c3ce54f80#,
187 16#9fd0913737c3fcbe#, 16#fa55f3f5459a9e79# );
188
189 Y : FZ(1 .. 4) := ( 16#d16b9d65bf3991d0#, 16#8a509a858786b366#,
190 16#d39d23682728f4f8#, 16#6c571dbc646bf513# );
191
192 Z : FZ(1 .. 4) := ( 0, 0, 0, 0 );
193
194 begin
195
196 Put_Line("~~~ Ch. 2 : FZ Bit Ops ~~~");
197 New_Line;
198 New_Line;
199
200 Put_Line("X =");
201 Dump(X);
202 New_Line;
203 New_Line;
204
205 Put_Line("Y =");
206 Dump(Y);
207 New_Line;
208 New_Line;
209
210 FZ_Neg(X, Z);
211 Put_Line("After FZ_Neg(X, Z):");
212 Put_Line("Z =");
213 Dump(Z);
214 New_Line;
215 New_Line;
216
217 FZ_And(X, Y, Z);
218 Put_Line("After FZ_And(X, Y, Z) :");
219 Put_Line("Z =");
220 Dump(Z);
221 New_Line;
222 New_Line;
223
224 FZ_Or(X, Y, Z);
225 Put_Line("After FZ_Or(X, Y, Z) :");
226 Put_Line("Z =");
227 Dump(Z);
228 New_Line;
229 New_Line;
230
231 FZ_Xor(X, Y, Z);
232 Put_Line("After FZ_Xor(X, Y, Z) :");
233 Put_Line("Z =");
234 Dump(Z);
235 New_Line;
236 New_Line;
237
238 Put_Line("FZ_EqP(X, X) :");
239 Dump(FZ_EqP(X, X));
240 New_Line;
241 New_Line;
242
243 Put_Line("FZ_EqP(X, Y) :");
244 Dump(FZ_EqP(X, Y));
245 New_Line;
246 New_Line;
247
248 Put_Line("FZ_LessThanP(X, Y) :");
249 Dump(FZ_LessThanP(X, Y));
250 New_Line;
251 New_Line;
252
253 Put_Line("FZ_LessThanP(Y, X) :");
254 Dump(FZ_LessThanP(Y, X));
255 New_Line;
256 New_Line;
257
258 Put_Line("FZ_GreaterThanP(X, Y) :");
259 Dump(FZ_GreaterThanP(X, Y));
260 New_Line;
261 New_Line;
262
263 Put_Line("FZ_GreaterThanP(Y, X) :");
264 Dump(FZ_GreaterThanP(Y, X));
265 New_Line;
266 New_Line;
267
268 end Demo_FZ_Various_Ops;
269
270
271 end Demo_Ch2;
-
+ D0EC9ED3535A120A612D261B779EC88A02EA7BE5A683399E8C49E2D1E8833897DD8B84F1E517DC570DE17E4CA6752B5654E5ADE3D3974D94842BCEBF57AB65BE
ffa/ffademo/demo_ch2.ads
(0 . 0)(1 . 26)
276 ------------------------------------------------------------------------------
277 ------------------------------------------------------------------------------
278 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
279 -- --
280 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
281 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
282 -- --
283 -- You do not have, nor can you ever acquire the right to use, copy or --
284 -- distribute this software ; Should you use this software for any purpose, --
285 -- or copy and distribute it to anyone or in any manner, you are breaking --
286 -- the laws of whatever soi-disant jurisdiction, and you promise to --
287 -- continue doing so for the indefinite future. In any case, please --
288 -- always : read and understand any software ; verify any PGP signatures --
289 -- that you use - for any purpose. --
290 -- --
291 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
292 ------------------------------------------------------------------------------
293 ------------------------------------------------------------------------------
294
295 package Demo_Ch2 is
296
297 procedure Demo_Word_Preds;
298 procedure Demo_FZ_Basics;
299 procedure Demo_FZ_Various_Ops;
300
301 end Demo_Ch2;
- 1E4B961E54FBFCEA9605A60C667B7F88BFA5C81481A765E9D256592542BF7E7C4F9A831A4702E4A8CF324DDB04B1ED106E76BE33FCC6D6CC05BD5238150184E2
+ 929CD7FD79C21425923705BD800100DD2405068BC84B5E8C9F3CB425BD7DC3A3C453A3016614B4DBC62AA05A5CDFF70FDB1812A25FFF2101A5BCF382BA574382
ffa/ffademo/ffa_demo.adb
(18 . 10)(18 . 17)
306 ------------------------------------------------------------------------------
307
308 with Demo_Ch1; use Demo_Ch1;
309 with Demo_Ch2; use Demo_Ch2;
310
311 procedure FFA_Demo is
312 begin
313
314 -- Ch. 1
315 Demo_Add_Sub;
316
317 -- Ch. 2
318 Demo_Word_Preds;
319 Demo_FZ_Basics;
320 Demo_FZ_Various_Ops;
321
322 end FFA_Demo;
-
+ 00F1170667A8787008530F64E8648158EDBBEC88DC26D7D7FC78DC796405A300F450E8FF290A66FF874DC2FDA5A3293012F4E1260E54E7BD421389FF908FD959
ffa/libffa/fz_basic.adb
(0 . 0)(1 . 54)
327 with Word_Ops; use Word_Ops;
328
329
330 package body FZ_Basic is
331
332 ---------------------------------------------------------------------------
333 -- Fundamental Operations on FZ (finite integers)
334 ---------------------------------------------------------------------------
335
336 -- N := 0
337 procedure FZ_Clear(N : out FZ) is
338 begin
339 N := (others => 0);
340 end FZ_Clear;
341 pragma Inline_Always(FZ_Clear);
342
343
344 -- First word of N := Source
345 procedure FZ_Set_Head(N : out FZ; Source : in Word) is
346 begin
347 N(N'First) := Source;
348 end FZ_Set_Head;
349 pragma Inline_Always(FZ_Set_Head);
350
351
352 -- First word of N
353 function FZ_Get_Head(N : in FZ) return Word is
354 begin
355 return N(N'First);
356 end FZ_Get_Head;
357 pragma Inline_Always(FZ_Get_Head);
358
359
360 -- Exchange X and Y
361 procedure FZ_Swap(X : in out FZ; Y : in out FZ) is
362 T : FZ(X'Range) := X;
363 begin
364 T := X;
365 X := Y;
366 Y := T;
367 end FZ_Swap;
368 pragma Inline_Always(FZ_Swap);
369
370
371 -- Constant-time MUX: Sel = 0: Result := X; Sel = 1: Result := Y
372 procedure FZ_Mux(X : in FZ; Y : in FZ; Result : out FZ; Sel : in WBool) is
373 begin
374 for i in X'Range loop
375 Result(i) := W_Mux(X(i), Y(i), Sel);
376 end loop;
377 end FZ_Mux;
378 pragma Inline_Always(FZ_Mux);
379
380 end FZ_Basic;
-
+ C41300D143792A5D7C9F2FE4F9EB94324E99A91EB2BA164504ACF37137802AC0B00B5F3BBD00A9D23A9043B3B8731DB50B763E0B23CE061093ABD436A6B2B286
ffa/libffa/fz_basic.ads
(0 . 0)(1 . 26)
385 with Words; use Words;
386 with FZ_Type; use FZ_Type;
387
388
389 package FZ_Basic is
390
391 pragma Pure;
392
393 -- N := 0
394 procedure FZ_Clear(N : out FZ);
395
396 -- First word of N := Source
397 procedure FZ_Set_Head(N : out FZ; Source : in Word);
398
399 -- First word of N
400 function FZ_Get_Head(N : in FZ) return Word;
401
402 -- Exchange X and Y
403 procedure FZ_Swap(X : in out FZ; Y : in out FZ);
404 pragma Precondition(X'Length = Y'Length);
405
406 -- Constant-time MUX: Sel = 0: Result := X; Sel = 1: Result := Y
407 procedure FZ_Mux(X : in FZ; Y : in FZ; Result : out FZ; Sel : in WBool);
408 pragma Precondition(X'Length = Y'Length and X'Length = Result'Length);
409
410 end FZ_Basic;
-
+ 00E146D70BDF4BC40B8E5B4687470F7A35132EABA708C8F04494121572E9675852087D2869FAA5759749DD3D2F14AEDE6259A115C1C2DFDF2D1551A49DF2C176
ffa/libffa/fz_bitop.adb
(0 . 0)(1 . 67)
415 package body FZ_BitOp is
416
417 -- Result := X & Y
418 procedure FZ_And(X : in FZ; Y : in FZ; Result : out FZ) is
419 begin
420 for i in X'Range loop
421 Result(i) := X(i) and Y(i);
422 end loop;
423 end FZ_And;
424 pragma Inline_Always(FZ_And);
425
426
427 -- N := N & W, W is a word
428 procedure FZ_And_W(N : in out FZ; W : in Word) is
429 begin
430 N(N'First) := N(N'First) and W;
431 end FZ_And_W;
432 pragma Inline_Always(FZ_And_W);
433
434
435 -- Result := X | Y
436 procedure FZ_Or(X : in FZ; Y : in FZ; Result : out FZ) is
437 begin
438 for i in X'Range loop
439 Result(i) := X(i) or Y(i);
440 end loop;
441 end FZ_Or;
442 pragma Inline_Always(FZ_Or);
443
444
445 -- N := N | W, W is a word
446 procedure FZ_Or_W(N : in out FZ; W : in Word) is
447 begin
448 N(N'First) := N(N'First) or W;
449 end FZ_Or_W;
450 pragma Inline_Always(FZ_Or_W);
451
452
453 -- Result := X ^ Y
454 procedure FZ_Xor(X : in FZ; Y : in FZ; Result : out FZ) is
455 begin
456 for i in X'Range loop
457 Result(i) := X(i) xor Y(i);
458 end loop;
459 end FZ_Xor;
460 pragma Inline_Always(FZ_Xor);
461
462
463 -- N := N ^ W, W is a word
464 procedure FZ_Xor_W(N : in out FZ; W : in Word) is
465 begin
466 N(N'First) := N(N'First) xor W;
467 end FZ_Xor_W;
468 pragma Inline_Always(FZ_Xor_W);
469
470
471 -- NotN := ~N
472 procedure FZ_Neg(N : in FZ;
473 NotN : out FZ) is
474 begin
475 for i in N'Range loop
476 NotN(i) := not N(i);
477 end loop;
478 end FZ_Neg;
479 pragma Inline_Always(FZ_Neg);
480
481 end FZ_BitOp;
-
+ 27EEADFDB34526DC90F3FACC0C01FA3EA2BE7353ABBDDDA0AD19255CE22AC25FA5118478CCD379BB6DB072735E23EC7ECF90B3973BE017878CCFB3581B8E16F2
ffa/libffa/fz_bitop.ads
(0 . 0)(1 . 34)
486 with FZ_Type; use FZ_Type;
487 with Words; use Words;
488
489
490 package FZ_BitOp is
491
492 pragma Pure;
493
494 -- Result := X & Y
495 procedure FZ_And(X : in FZ; Y : in FZ; Result : out FZ);
496 pragma Precondition(X'Length = Y'Length and X'Length = Result'Length);
497
498 -- N := N & W, W is a word
499 procedure FZ_And_W(N : in out FZ; W : in Word);
500
501 -- Result := X | Y
502 procedure FZ_Or(X : in FZ; Y : in FZ; Result : out FZ);
503 pragma Precondition(X'Length = Y'Length and X'Length = Result'Length);
504
505 -- N := N | W, W is a word
506 procedure FZ_Or_W(N : in out FZ; W : in Word);
507
508 -- Result := X ^ Y
509 procedure FZ_Xor(X : in FZ; Y : in FZ; Result : out FZ);
510 pragma Precondition(X'Length = Y'Length and X'Length = Result'Length);
511
512 -- N := N ^ W, W is a word
513 procedure FZ_Xor_W(N : in out FZ; W : in Word);
514
515 -- NotN := ~N
516 procedure FZ_Neg(N : in FZ; NotN : out FZ);
517 pragma Precondition(N'Length = NotN'Length);
518
519 end FZ_BitOp;
-
+ 2354C226B429A80777A4731F2300F13EA59E023BDD6C33E17FD65F5C22C1D2ED84A17CC6624D1FD00D5D1CBD6B69913F32FAEF626070488C800BFAC29991A4C4
ffa/libffa/fz_cmp.adb
(0 . 0)(1 . 44)
524 with W_Pred; use W_Pred;
525 with FZ_Arith; use FZ_Arith;
526
527
528 package body FZ_Cmp is
529
530 ---------------------------------------------
531 -- Arithmetical Predicate Operations on FZ --
532 ---------------------------------------------
533
534 -- 1 iff X == Y (branch-free); else 0
535 function FZ_EqP(X : in FZ; Y : in FZ) return WBool is
536 A : WBool := 1;
537 begin
538 for i in X'Range loop
539 A := A and W_EqP(X(i), Y(i));
540 end loop;
541 return A;
542 end FZ_EqP;
543 pragma Inline_Always(FZ_EqP);
544
545
546 -- 1 iff X < Y (branch-free); else 0
547 function FZ_LessThanP(X : in FZ; Y : in FZ) return WBool is
548 Scratch : FZ(X'Range);
549 Borrow : WBool := 0;
550 begin
551 FZ_Sub(X, Y, Scratch, Borrow);
552 return Borrow;
553 end FZ_LessThanP;
554 pragma Inline_Always(FZ_LessThanP);
555
556
557 -- 1 iff X > Y (branch-free); else 0
558 function FZ_GreaterThanP(X : in FZ; Y: in FZ) return WBool is
559 Scratch : FZ(X'Range);
560 Borrow : WBool := 0;
561 begin
562 FZ_Sub(Y, X, Scratch, Borrow);
563 return Borrow;
564 end FZ_GreaterThanP;
565 pragma Inline_Always(FZ_GreaterThanP);
566
567 end FZ_Cmp;
-
+ A0AF30915DDF0A84F4ECA02A13F1C607BCD01B2A49998B4002A40F50A436CC4A61AA25922EBECE99A837662D76F0950FE63695ED1CC424792FE00B81E3E98E82
ffa/libffa/fz_cmp.ads
(0 . 0)(1 . 25)
572 with Words; use Words;
573 with FZ_Type; use FZ_Type;
574
575
576 package FZ_Cmp is
577
578 pragma Pure;
579
580 -------------------------------------------
581 -- Comparison Predicate Operations on FZ --
582 -------------------------------------------
583
584 -- 1 iff X == Y (branch-free); else 0
585 function FZ_EqP(X : in FZ; Y: in FZ) return WBool;
586 pragma Precondition(X'Length = Y'Length);
587
588 -- 1 iff X < Y (branch-free); else 0
589 function FZ_LessThanP(X : in FZ; Y : in FZ) return WBool;
590 pragma Precondition(X'Length = Y'Length);
591
592 -- 1 iff X > Y (branch-free); else 0
593 function FZ_GreaterThanP(X : in FZ; Y : in FZ) return WBool;
594 pragma Precondition(X'Length = Y'Length);
595
596 end FZ_Cmp;
-
+ EF003DD5035581C12D242FA697E39248A2B1E26CE2EB0713F4BAC79816FE602174C3280840B698593456FAE2983D249493570FC86C5BC9B1E80FD715E1E44438
ffa/libffa/fz_pred.adb
(0 . 0)(1 . 29)
601 with W_Pred; use W_Pred;
602
603
604 package body FZ_Pred is
605
606 ---------------------------------------------------------------------------
607 -- Fundamental Predicate Operations on FZ (finite integers)
608 ---------------------------------------------------------------------------
609
610 -- 1 iff N == 0 (branch-free); else 0
611 function FZ_ZeroP(N : in FZ) return WBool is
612 A : WBool := 1;
613 begin
614 for i in N'Range loop
615 A := A and W_ZeroP(N(i));
616 end loop;
617 return A;
618 end FZ_ZeroP;
619 pragma Inline_Always(FZ_ZeroP);
620
621
622 -- 1 iff N is odd
623 function FZ_OddP(N : in FZ) return WBool is
624 begin
625 return W_OddP(N(N'First));
626 end FZ_OddP;
627 pragma Inline_Always(FZ_OddP);
628
629 end FZ_Pred;
-
+ 618A69A4BBB18555C26135CDFB3279183D88D47495F89D601670DFE911524078BF7AB5C3025712AD4CC1448B302D11AB3E47CD74E870401FAADAB6303831A5B9
ffa/libffa/fz_pred.ads
(0 . 0)(1 . 19)
634 with Words; use Words;
635 with FZ_Type; use FZ_Type;
636
637
638 package FZ_Pred is
639
640 pragma Pure;
641
642 --------------------------------------------
643 -- Fundamental Predicate Operations on FZ --
644 --------------------------------------------
645
646 -- 1 iff N == 0 (branch-free); else 0
647 function FZ_ZeroP(N : in FZ) return WBool;
648
649 -- 1 iff N is odd
650 function FZ_OddP(N : in FZ) return WBool;
651
652 end FZ_Pred;
-
+ 5D4D9AA640F4415DCF8E18DFAF299FCE4FA2C5DEDA3B22C851D67F54423814F035CCF4AE9184D4933BB90E0EA35E70F71A19B12DA905584A374986618026E1A8
ffa/libffa/w_pred.adb
(0 . 0)(1 . 56)
657 ------------------------------------------------------------------------------
658 ------------------------------------------------------------------------------
659 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
660 -- --
661 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
662 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
663 -- --
664 -- You do not have, nor can you ever acquire the right to use, copy or --
665 -- distribute this software ; Should you use this software for any purpose, --
666 -- or copy and distribute it to anyone or in any manner, you are breaking --
667 -- the laws of whatever soi-disant jurisdiction, and you promise to --
668 -- continue doing so for the indefinite future. In any case, please --
669 -- always : read and understand any software ; verify any PGP signatures --
670 -- that you use - for any purpose. --
671 -- --
672 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
673 ------------------------------------------------------------------------------
674 ------------------------------------------------------------------------------
675
676 with Word_Ops; use Word_Ops;
677
678 -- Elementary Predicates on Words:
679 package body W_Pred is
680
681 -- Return 1 if N is equal to 0; otherwise return 0.
682 function W_ZeroP(N : in Word) return WBool is
683 begin
684 return W_Borrow(N, 1, N - 1);
685 end W_ZeroP;
686 pragma Inline_Always(W_ZeroP);
687
688
689 -- Return 1 if N is unequal to 0; otherwise return 0.
690 function W_NZeroP(N : in Word) return WBool is
691 begin
692 return 1 xor W_ZeroP(N);
693 end W_NZeroP;
694 pragma Inline_Always(W_NZeroP);
695
696
697 -- Return 1 if N is odd; otherwise return 0.
698 function W_OddP(N : in Word) return WBool is
699 begin
700 return 1 and N;
701 end W_OddP;
702 pragma Inline_Always(W_OddP);
703
704
705 -- Return 1 if A is equal to B ; otherwise return 0.
706 function W_EqP(A : in Word; B : in Word) return WBool is
707 begin
708 return W_ZeroP(A xor B);
709 end W_EqP;
710 pragma Inline_Always(W_EqP);
711
712 end W_Pred;
-
+ A8B74FCF54F88EE08E1F4760729EA54088C2D21DB24083E695FD1C7BF0B17EEC9A4D614045BB337FD0F5C7F8BF30D7BD80063F7DFE7FE28E2E49078BA52E8250
ffa/libffa/w_pred.ads
(0 . 0)(1 . 39)
717 ------------------------------------------------------------------------------
718 ------------------------------------------------------------------------------
719 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
720 -- --
721 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
722 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
723 -- --
724 -- You do not have, nor can you ever acquire the right to use, copy or --
725 -- distribute this software ; Should you use this software for any purpose, --
726 -- or copy and distribute it to anyone or in any manner, you are breaking --
727 -- the laws of whatever soi-disant jurisdiction, and you promise to --
728 -- continue doing so for the indefinite future. In any case, please --
729 -- always : read and understand any software ; verify any PGP signatures --
730 -- that you use - for any purpose. --
731 -- --
732 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
733 ------------------------------------------------------------------------------
734 ------------------------------------------------------------------------------
735
736 with Words; use Words;
737
738 -- Elementary Predicates on Words:
739 package W_Pred is
740
741 pragma Pure;
742
743 -- Return 1 if N is equal to 0; otherwise return 0.
744 function W_ZeroP(N : in Word) return WBool;
745
746 -- Return 1 if N is unequal to 0; otherwise return 0.
747 function W_NZeroP(N : in Word) return WBool;
748
749 -- Return 1 if N is odd; otherwise return 0.
750 function W_OddP(N : in Word) return WBool;
751
752 -- Return 1 if A is equal to B ; otherwise return 0.
753 function W_EqP(A : in Word; B : in Word) return WBool;
754
755 end W_Pred;
- 7CA5191747D159092841AF1D29A5779075AB1C74F3CCAA94B187DC135D76819034CA9666AE01ABC3212D47A2BDDF06A56DAD178591646225B17E11801CDEEBAC
+ 0431D4E5164D5119F81331E3A7EF2F69A397D4A35655274D79A809B69CD10324BEFF9359194A503DBC5AB085B2214E96AFEE97DB984E6625233BB975D9407FAB
ffa/libffa/word_ops.adb
(88 . 14)(88 . 4)
760 end W_Mux;
761 pragma Inline_Always(W_Mux);
762
763
764 -- Exchange A and B.
765 procedure W_Swap(A : in out Word; B : in out Word) is
766 begin
767 A := A xor B;
768 B := A xor B;
769 A := A xor B;
770 end W_Swap;
771 pragma Inline_Always(W_Swap);
772
773 end Word_Ops;
- 991563401E923B6D1448644D1AD8FE238E79F5154F98D7317D38227C5856D6CFB55FCEE27C5DDA316E70464A3F234831358B58D9B409CF2D5DB90AA1F38D9E92
+ EEDC4547993ABF2B50486519D32D6AC22A798F2ACF8959AD80F5877BE406B1D02CEA313F7A1B718F029011B31A5DB36C5472E99ED3C4C837B17C613D915BA4CF
ffa/libffa/word_ops.ads
(36 . 7)(36 . 4)
778 function W_Mux(A : in Word; B : in Word; Sel : in WBool)
779 return Word;
780
781 -- Exchange A and B.
782 procedure W_Swap(A : in out Word; B : in out Word);
783
784 end Word_Ops;