raw
ffa_ch2_logicals.kv     1 with W_Pred;   use W_Pred;
ffa_ch2_logicals.kv 2 with FZ_Arith; use FZ_Arith;
ffa_ch2_logicals.kv 3
ffa_ch2_logicals.kv 4
ffa_ch2_logicals.kv 5 package body FZ_Cmp is
ffa_ch2_logicals.kv 6
ffa_ch2_logicals.kv 7 ---------------------------------------------
ffa_ch2_logicals.kv 8 -- Arithmetical Predicate Operations on FZ --
ffa_ch2_logicals.kv 9 ---------------------------------------------
ffa_ch2_logicals.kv 10
ffa_ch2_logicals.kv 11 -- 1 iff X == Y (branch-free); else 0
ffa_ch2_logicals.kv 12 function FZ_EqP(X : in FZ; Y : in FZ) return WBool is
ffa_ch2_logicals.kv 13 A : WBool := 1;
ffa_ch2_logicals.kv 14 begin
ffa_ch2_logicals.kv 15 for i in X'Range loop
ffa_ch2_logicals.kv 16 A := A and W_EqP(X(i), Y(i));
ffa_ch2_logicals.kv 17 end loop;
ffa_ch2_logicals.kv 18 return A;
ffa_ch2_logicals.kv 19 end FZ_EqP;
ffa_ch2_logicals.kv 20 pragma Inline_Always(FZ_EqP);
ffa_ch2_logicals.kv 21
ffa_ch2_logicals.kv 22
ffa_ch2_logicals.kv 23 -- 1 iff X < Y (branch-free); else 0
ffa_ch2_logicals.kv 24 function FZ_LessThanP(X : in FZ; Y : in FZ) return WBool is
ffa_ch2_logicals.kv 25 Scratch : FZ(X'Range);
ffa_ch2_logicals.kv 26 Borrow : WBool := 0;
ffa_ch2_logicals.kv 27 begin
ffa_ch2_logicals.kv 28 FZ_Sub(X, Y, Scratch, Borrow);
ffa_ch2_logicals.kv 29 return Borrow;
ffa_ch2_logicals.kv 30 end FZ_LessThanP;
ffa_ch2_logicals.kv 31 pragma Inline_Always(FZ_LessThanP);
ffa_ch2_logicals.kv 32
ffa_ch2_logicals.kv 33
ffa_ch2_logicals.kv 34 -- 1 iff X > Y (branch-free); else 0
ffa_ch2_logicals.kv 35 function FZ_GreaterThanP(X : in FZ; Y: in FZ) return WBool is
ffa_ch2_logicals.kv 36 Scratch : FZ(X'Range);
ffa_ch2_logicals.kv 37 Borrow : WBool := 0;
ffa_ch2_logicals.kv 38 begin
ffa_ch2_logicals.kv 39 FZ_Sub(Y, X, Scratch, Borrow);
ffa_ch2_logicals.kv 40 return Borrow;
ffa_ch2_logicals.kv 41 end FZ_GreaterThanP;
ffa_ch2_logicals.kv 42 pragma Inline_Always(FZ_GreaterThanP);
ffa_ch2_logicals.kv 43
ffa_ch2_logicals.kv 44 end FZ_Cmp;