raw
ffa_ch2_logicals.kv     1 ------------------------------------------------------------------------------
ffa_ch2_logicals.kv 2 ------------------------------------------------------------------------------
ffa_ch2_logicals.kv 3 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
ffa_ch2_logicals.kv 4 -- --
ffa_ch15_gcd.kv 5 -- (C) 2019 Stanislav Datskovskiy ( www.loper-os.org ) --
ffa_ch2_logicals.kv 6 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
ffa_ch2_logicals.kv 7 -- --
ffa_ch2_logicals.kv 8 -- You do not have, nor can you ever acquire the right to use, copy or --
ffa_ch2_logicals.kv 9 -- distribute this software ; Should you use this software for any purpose, --
ffa_ch2_logicals.kv 10 -- or copy and distribute it to anyone or in any manner, you are breaking --
ffa_ch2_logicals.kv 11 -- the laws of whatever soi-disant jurisdiction, and you promise to --
ffa_ch2_logicals.kv 12 -- continue doing so for the indefinite future. In any case, please --
ffa_ch2_logicals.kv 13 -- always : read and understand any software ; verify any PGP signatures --
ffa_ch2_logicals.kv 14 -- that you use - for any purpose. --
ffa_ch2_logicals.kv 15 -- --
ffa_ch2_logicals.kv 16 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
ffa_ch2_logicals.kv 17 ------------------------------------------------------------------------------
ffa_ch2_logicals.kv 18 ------------------------------------------------------------------------------
ffa_ch2_logicals.kv 19
ffa_ch2_logicals.kv 20 with Word_Ops; use Word_Ops;
ffa_ch2_logicals.kv 21
ffa_ch16_miller_r... 22
ffa_ch2_logicals.kv 23 -- Elementary Predicates on Words:
ffa_ch2_logicals.kv 24 package body W_Pred is
ffa_ch2_logicals.kv 25
ffa_ch2_logicals.kv 26 -- Return 1 if N is equal to 0; otherwise return 0.
ffa_ch2_logicals.kv 27 function W_ZeroP(N : in Word) return WBool is
ffa_ch2_logicals.kv 28 begin
ffa_ch2_logicals.kv 29 return W_Borrow(N, 1, N - 1);
ffa_ch2_logicals.kv 30 end W_ZeroP;
ffa_ch2_logicals.kv 31
ffa_ch2_logicals.kv 32
ffa_ch2_logicals.kv 33 -- Return 1 if N is unequal to 0; otherwise return 0.
ffa_ch2_logicals.kv 34 function W_NZeroP(N : in Word) return WBool is
ffa_ch2_logicals.kv 35 begin
ffa_ch2_logicals.kv 36 return 1 xor W_ZeroP(N);
ffa_ch2_logicals.kv 37 end W_NZeroP;
ffa_ch2_logicals.kv 38
ffa_ch2_logicals.kv 39
ffa_ch5_egypt.kv 40 -- Return WBool-complement of N.
ffa_ch5_egypt.kv 41 function W_Not(N : in WBool) return WBool is
ffa_ch5_egypt.kv 42 begin
ffa_ch5_egypt.kv 43 return 1 xor N;
ffa_ch5_egypt.kv 44 end W_Not;
ffa_ch5_egypt.kv 45
ffa_ch5_egypt.kv 46
ffa_ch2_logicals.kv 47 -- Return 1 if N is odd; otherwise return 0.
ffa_ch2_logicals.kv 48 function W_OddP(N : in Word) return WBool is
ffa_ch2_logicals.kv 49 begin
ffa_ch2_logicals.kv 50 return 1 and N;
ffa_ch2_logicals.kv 51 end W_OddP;
ffa_ch2_logicals.kv 52
ffa_ch2_logicals.kv 53
ffa_ch2_logicals.kv 54 -- Return 1 if A is equal to B ; otherwise return 0.
ffa_ch2_logicals.kv 55 function W_EqP(A : in Word; B : in Word) return WBool is
ffa_ch2_logicals.kv 56 begin
ffa_ch2_logicals.kv 57 return W_ZeroP(A xor B);
ffa_ch2_logicals.kv 58 end W_EqP;
ffa_ch2_logicals.kv 59
ffa_ch16_miller_r... 60
ffa_ch16_miller_r... 61 -- Return 1 if A is less than B ; otherwise return 0.
ffa_ch16_miller_r... 62 function W_LtP(A : in Word; B : in Word) return WBool is
ffa_ch16_miller_r... 63 begin
ffa_ch16_miller_r... 64 return W_Borrow(A, B, A - B);
ffa_ch16_miller_r... 65 end W_LtP;
ffa_ch16_miller_r... 66
ffa_ch2_logicals.kv 67 end W_Pred;