------------------------------------------------------------------------------ ------------------------------------------------------------------------------ -- This file is part of 'Finite Field Arithmetic', aka 'FFA'. -- -- -- -- (C) 2019 Stanislav Datskovskiy ( www.loper-os.org ) -- -- http://wot.deedbot.org/17215D118B7239507FAFED98B98228A001ABFFC7.html -- -- -- -- You do not have, nor can you ever acquire the right to use, copy or -- -- distribute this software ; Should you use this software for any purpose, -- -- or copy and distribute it to anyone or in any manner, you are breaking -- -- the laws of whatever soi-disant jurisdiction, and you promise to -- -- continue doing so for the indefinite future. In any case, please -- -- always : read and understand any software ; verify any PGP signatures -- -- that you use - for any purpose. -- -- -- -- See also http://trilema.com/2015/a-new-software-licensing-paradigm . -- ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ with FZ_Type; use FZ_Type; -- "Low Multiplication" computes only the bottom half of the product XY. -- Presently, it is used solely in Barrett's Modular Reduction. package FZ_LoMul is pragma Pure; -- Threshhold for Low Mul - at or below this many Words, we use Comba mult. Low_Mul_Thresh : constant Indices := 8; -- Multiply. (CAUTION: UNBUFFERED) procedure FZ_Low_Multiply_Unbuffered(X : in FZ; Y : in FZ; XY : out FZ); pragma Inline_Always(FZ_Low_Multiply_Unbuffered); -- Comba's multiplier. (CAUTION: UNBUFFERED) procedure FZ_Low_Mul_Comba(X : in FZ; Y : in FZ; XY : out FZ); pragma Inline_Always(FZ_Low_Mul_Comba); -- Low Multiplier. (CAUTION: UNBUFFERED) procedure Low_Mul(X : in FZ; Y : in FZ; XY : out FZ) with Pre => X'Length = Y'Length and XY'Length = X'Length and X'Length mod 2 = 0; -- CAUTION: Inlining prohibited for Low_Mul ! -- Low-Only Multiplier. Preserves the inputs. procedure FZ_Low_Multiply_Buffered(X : in FZ; Y : in FZ; XY : out FZ) with Pre => X'Length = Y'Length and XY'Length = X'Length and X'Length mod 2 = 0; end FZ_LoMul;