(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;