raw
ffa_ch3_shifts.kv       1 ------------------------------------------------------------------------------
ffa_ch3_shifts.kv 2 ------------------------------------------------------------------------------
ffa_ch3_shifts.kv 3 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
ffa_ch3_shifts.kv 4 -- --
ffa_ch15_gcd.kv 5 -- (C) 2019 Stanislav Datskovskiy ( www.loper-os.org ) --
ffa_ch3_shifts.kv 6 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
ffa_ch3_shifts.kv 7 -- --
ffa_ch3_shifts.kv 8 -- You do not have, nor can you ever acquire the right to use, copy or --
ffa_ch3_shifts.kv 9 -- distribute this software ; Should you use this software for any purpose, --
ffa_ch3_shifts.kv 10 -- or copy and distribute it to anyone or in any manner, you are breaking --
ffa_ch3_shifts.kv 11 -- the laws of whatever soi-disant jurisdiction, and you promise to --
ffa_ch3_shifts.kv 12 -- continue doing so for the indefinite future. In any case, please --
ffa_ch3_shifts.kv 13 -- always : read and understand any software ; verify any PGP signatures --
ffa_ch3_shifts.kv 14 -- that you use - for any purpose. --
ffa_ch3_shifts.kv 15 -- --
ffa_ch3_shifts.kv 16 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
ffa_ch3_shifts.kv 17 ------------------------------------------------------------------------------
ffa_ch3_shifts.kv 18 ------------------------------------------------------------------------------
ffa_ch3_shifts.kv 19
ffa_ch2_logicals.kv 20 with W_Pred; use W_Pred;
ffa_ch2_logicals.kv 21 with FZ_Arith; use FZ_Arith;
ffa_ch16_miller_r... 22 with FZ_Pred; use FZ_Pred;
ffa_ch2_logicals.kv 23
ffa_ch2_logicals.kv 24
ffa_ch2_logicals.kv 25 package body FZ_Cmp is
ffa_ch2_logicals.kv 26
ffa_ch2_logicals.kv 27 ---------------------------------------------
ffa_ch2_logicals.kv 28 -- Arithmetical Predicate Operations on FZ --
ffa_ch2_logicals.kv 29 ---------------------------------------------
ffa_ch2_logicals.kv 30
ffa_ch2_logicals.kv 31 -- 1 iff X == Y (branch-free); else 0
ffa_ch2_logicals.kv 32 function FZ_EqP(X : in FZ; Y : in FZ) return WBool is
ffa_ch2_logicals.kv 33 A : WBool := 1;
ffa_ch2_logicals.kv 34 begin
ffa_ch2_logicals.kv 35 for i in X'Range loop
ffa_ch2_logicals.kv 36 A := A and W_EqP(X(i), Y(i));
ffa_ch2_logicals.kv 37 end loop;
ffa_ch2_logicals.kv 38 return A;
ffa_ch2_logicals.kv 39 end FZ_EqP;
ffa_ch2_logicals.kv 40
ffa_ch2_logicals.kv 41
ffa_ch16_miller_r... 42 -- 1 iff X == W (branch-free); else 0
ffa_ch16_miller_r... 43 function FZ_EqP_W(X : in FZ; W : in Word) return WBool is
ffa_ch16_miller_r... 44 begin
ffa_ch16_miller_r... 45 return FZ_OneWordP(X) and W_EqP(X(X'First), W);
ffa_ch16_miller_r... 46 end FZ_EqP_W;
ffa_ch16_miller_r... 47
ffa_ch16_miller_r... 48
ffa_ch2_logicals.kv 49 -- 1 iff X < Y (branch-free); else 0
ffa_ch2_logicals.kv 50 function FZ_LessThanP(X : in FZ; Y : in FZ) return WBool is
ffa_ch2_logicals.kv 51 Scratch : FZ(X'Range);
ffa_ch2_logicals.kv 52 Borrow : WBool := 0;
ffa_ch2_logicals.kv 53 begin
ffa_ch2_logicals.kv 54 FZ_Sub(X, Y, Scratch, Borrow);
ffa_ch2_logicals.kv 55 return Borrow;
ffa_ch2_logicals.kv 56 end FZ_LessThanP;
ffa_ch2_logicals.kv 57
ffa_ch2_logicals.kv 58
ffa_ch2_logicals.kv 59 -- 1 iff X > Y (branch-free); else 0
ffa_ch2_logicals.kv 60 function FZ_GreaterThanP(X : in FZ; Y: in FZ) return WBool is
ffa_ch2_logicals.kv 61 Scratch : FZ(X'Range);
ffa_ch2_logicals.kv 62 Borrow : WBool := 0;
ffa_ch2_logicals.kv 63 begin
ffa_ch2_logicals.kv 64 FZ_Sub(Y, X, Scratch, Borrow);
ffa_ch2_logicals.kv 65 return Borrow;
ffa_ch2_logicals.kv 66 end FZ_GreaterThanP;
ffa_ch2_logicals.kv 67
ffa_ch2_logicals.kv 68 end FZ_Cmp;