VSSL/source/library/vssl-extensible_arithmetic.ads

31 lines
730 B
Ada

--
-- Basic arbitrary precision arithmeric building blocks.
-- 32 bit (with use of 64 bit intemediate type) portable implementation
--
with Interfaces;
use Interfaces;
package VSSL.Extensible_Arithmetic with Pure is
Limb_Size : constant := 32;
subtype Limb is Unsigned_32;
Minus_One_Limb : constant Limb := Limb'Last;
function Is_Negative (X : Limb) return Boolean is
((X and 2**(Limb_Size - 1)) /= 0);
procedure Multiply (
CO, -- Product carry out (higher part)
M : out Limb; -- Product (lower part)
A,
B : in Limb; -- Multiplicands
CI : in Limb := 0); -- Carry In (added to product)
private
subtype Product is Unsigned_32;
end VSSL.Extensible_Arithmetic;