- 5235054F1A2FFC6F2560122D8623A3ACDD486B15F85A930CB6099622008571EC59B56A423AF2D061FC39931BF624B231425212D28BBD06E9FAEA148EBE3A5148+ 3E868323D9FB836971DBB971A2996FF7868407DF3B7CCA05E2AE02C24A919B8D0C6277F93B1A9073D612C0092D0E1280AFAFBF3996F452C053B4C1433F529C54ffa/libffa/fz_measr.adb(17 . 6)(17 . 7)
 818 ------------------------------------------------------------------------------
 819 ------------------------------------------------------------------------------
 820 
 821 with Words;    use Words;
 822 with Word_Ops; use Word_Ops;
 823 with W_Pred;   use W_Pred;
 824 with W_Shifts; use W_Shifts;
(25 . 7)(26 . 7)
 826 package body FZ_Measr is
 827    
 828    -- Find the index of eldest nonzero bit ( 0 if none, or 1 .. FZBitness )
 829    function FZ_Measure(N : in FZ) return Word is
 830    function FZ_Measure(N : in FZ) return FZBit_Index is
 831       
 832       -- The result (default : 0, will remain 0 if N is in fact zero)
 833       Index     : Word := 0;
(54 . 14)(55 . 17)
 835       
 836       -- Find, in constant time, eldest non-zero bit in that Word:
 837       for b in 1 .. Bitness loop
 838          
 839          -- If W is non-zero, advance the Index...
 840          Index := W_Mux(Index + 1, Index, W_ZeroP(W));
 841          Index := Index + W_NZeroP(W);
 842          
 843          -- ... in either case, advance W:
 844          W     := Shift_Right(W, 1);
 845          
 846       end loop;
 847       
 848       -- If N = 0, result will be 0; otherwise: index of the eldest 1 bit.
 849       return Index;
 850       return FZBit_Index(Index);
 851       
 852    end FZ_Measure;
 853