-
+ 5D4D9AA640F4415DCF8E18DFAF299FCE4FA2C5DEDA3B22C851D67F54423814F035CCF4AE9184D4933BB90E0EA35E70F71A19B12DA905584A374986618026E1A8
ffa/libffa/w_pred.adb
(0 . 0)(1 . 56)
657 ------------------------------------------------------------------------------
658 ------------------------------------------------------------------------------
659 -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. --
660 -- --
661 -- (C) 2017 Stanislav Datskovskiy ( www.loper-os.org ) --
662 -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html --
663 -- --
664 -- You do not have, nor can you ever acquire the right to use, copy or --
665 -- distribute this software ; Should you use this software for any purpose, --
666 -- or copy and distribute it to anyone or in any manner, you are breaking --
667 -- the laws of whatever soi-disant jurisdiction, and you promise to --
668 -- continue doing so for the indefinite future. In any case, please --
669 -- always : read and understand any software ; verify any PGP signatures --
670 -- that you use - for any purpose. --
671 -- --
672 -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . --
673 ------------------------------------------------------------------------------
674 ------------------------------------------------------------------------------
675
676 with Word_Ops; use Word_Ops;
677
678 -- Elementary Predicates on Words:
679 package body W_Pred is
680
681 -- Return 1 if N is equal to 0; otherwise return 0.
682 function W_ZeroP(N : in Word) return WBool is
683 begin
684 return W_Borrow(N, 1, N - 1);
685 end W_ZeroP;
686 pragma Inline_Always(W_ZeroP);
687
688
689 -- Return 1 if N is unequal to 0; otherwise return 0.
690 function W_NZeroP(N : in Word) return WBool is
691 begin
692 return 1 xor W_ZeroP(N);
693 end W_NZeroP;
694 pragma Inline_Always(W_NZeroP);
695
696
697 -- Return 1 if N is odd; otherwise return 0.
698 function W_OddP(N : in Word) return WBool is
699 begin
700 return 1 and N;
701 end W_OddP;
702 pragma Inline_Always(W_OddP);
703
704
705 -- Return 1 if A is equal to B ; otherwise return 0.
706 function W_EqP(A : in Word; B : in Word) return WBool is
707 begin
708 return W_ZeroP(A xor B);
709 end W_EqP;
710 pragma Inline_Always(W_EqP);
711
712 end W_Pred;