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_ch3_shifts.kv 5 -- (C) 2017 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 package body FZ_BitOp is
ffa_ch2_logicals.kv 21
ffa_ch2_logicals.kv 22 -- Result := X & Y
ffa_ch2_logicals.kv 23 procedure FZ_And(X : in FZ; Y : in FZ; Result : out FZ) is
ffa_ch2_logicals.kv 24 begin
ffa_ch2_logicals.kv 25 for i in X'Range loop
ffa_ch2_logicals.kv 26 Result(i) := X(i) and Y(i);
ffa_ch2_logicals.kv 27 end loop;
ffa_ch2_logicals.kv 28 end FZ_And;
ffa_ch2_logicals.kv 29
ffa_ch2_logicals.kv 30
ffa_ch2_logicals.kv 31 -- N := N & W, W is a word
ffa_ch2_logicals.kv 32 procedure FZ_And_W(N : in out FZ; W : in Word) is
ffa_ch2_logicals.kv 33 begin
ffa_ch2_logicals.kv 34 N(N'First) := N(N'First) and W;
ffa_ch2_logicals.kv 35 end FZ_And_W;
ffa_ch2_logicals.kv 36
ffa_ch2_logicals.kv 37
ffa_ch2_logicals.kv 38 -- Result := X | Y
ffa_ch2_logicals.kv 39 procedure FZ_Or(X : in FZ; Y : in FZ; Result : out FZ) is
ffa_ch2_logicals.kv 40 begin
ffa_ch2_logicals.kv 41 for i in X'Range loop
ffa_ch2_logicals.kv 42 Result(i) := X(i) or Y(i);
ffa_ch2_logicals.kv 43 end loop;
ffa_ch2_logicals.kv 44 end FZ_Or;
ffa_ch2_logicals.kv 45
ffa_ch2_logicals.kv 46
ffa_ch2_logicals.kv 47 -- N := N | W, W is a word
ffa_ch2_logicals.kv 48 procedure FZ_Or_W(N : in out FZ; W : in Word) is
ffa_ch2_logicals.kv 49 begin
ffa_ch2_logicals.kv 50 N(N'First) := N(N'First) or W;
ffa_ch2_logicals.kv 51 end FZ_Or_W;
ffa_ch2_logicals.kv 52
ffa_ch2_logicals.kv 53
ffa_ch2_logicals.kv 54 -- Result := X ^ Y
ffa_ch2_logicals.kv 55 procedure FZ_Xor(X : in FZ; Y : in FZ; Result : out FZ) is
ffa_ch2_logicals.kv 56 begin
ffa_ch2_logicals.kv 57 for i in X'Range loop
ffa_ch2_logicals.kv 58 Result(i) := X(i) xor Y(i);
ffa_ch2_logicals.kv 59 end loop;
ffa_ch2_logicals.kv 60 end FZ_Xor;
ffa_ch2_logicals.kv 61
ffa_ch2_logicals.kv 62
ffa_ch2_logicals.kv 63 -- N := N ^ W, W is a word
ffa_ch2_logicals.kv 64 procedure FZ_Xor_W(N : in out FZ; W : in Word) is
ffa_ch2_logicals.kv 65 begin
ffa_ch2_logicals.kv 66 N(N'First) := N(N'First) xor W;
ffa_ch2_logicals.kv 67 end FZ_Xor_W;
ffa_ch2_logicals.kv 68
ffa_ch2_logicals.kv 69
ffa_ch2_logicals.kv 70 -- NotN := ~N
ffa_ch3_shifts.kv 71 procedure FZ_Not(N : in FZ;
ffa_ch2_logicals.kv 72 NotN : out FZ) is
ffa_ch2_logicals.kv 73 begin
ffa_ch2_logicals.kv 74 for i in N'Range loop
ffa_ch2_logicals.kv 75 NotN(i) := not N(i);
ffa_ch2_logicals.kv 76 end loop;
ffa_ch3_shifts.kv 77 end FZ_Not;
ffa_ch2_logicals.kv 78
ffa_ch2_logicals.kv 79 end FZ_BitOp;