Multiply {s1p, s1n} and {s2p, s2n}, and write the (s1n + s2n)-limb result to rp.
Namespace:
Math.Gmp.Native
Assembly:
Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static mp_limb_t mpn_mul(
mp_ptr rp,
mp_ptr s1p,
mp_size_t s1n,
mp_ptr s2p,
mp_size_t s2n
)
Public Shared Function mpn_mul (
rp As mp_ptr,
s1p As mp_ptr,
s1n As mp_size_t,
s2p As mp_ptr,
s2n As mp_size_t
) As mp_limb_t
public:
static mp_limb_t mpn_mul(
mp_ptr^ rp,
mp_ptr^ s1p,
mp_size_t s1n,
mp_ptr^ s2p,
mp_size_t s2n
)
static member mpn_mul :
rp : mp_ptr *
s1p : mp_ptr *
s1n : mp_size_t *
s2p : mp_ptr *
s2n : mp_size_t -> mp_limb_t
Parameters
- rp
- Type: Math.Gmp.Nativemp_ptr
The result integer. - s1p
- Type: Math.Gmp.Nativemp_ptr
The first operand integer. - s1n
- Type: Math.Gmp.Nativemp_size_t
The number of limbs of s1p. - s2p
- Type: Math.Gmp.Nativemp_ptr
The first operand integer. - s2n
- Type: Math.Gmp.Nativemp_size_t
The number of limbs of s2p.
Return Value
Type:
mp_limb_tReturn the most significant limb of the result.
Remarks
The destination has to have space for s1n + s2n limbs,
even if the product’s most significant limb is zero.
No overlap is permitted between the destination and either source.
This function requires that s1n is greater than or equal to s2n.
Examples
mp_ptr s1p = new mp_ptr(new uint[] { 0xffffffff, 0xffffffff });
mp_ptr s2p = new mp_ptr(new uint[] { 0x00000002 });
mp_ptr rp = new mp_ptr(new uint[3]);
mp_ptr result = new mp_ptr(new uint[] { 0xfffffffe, 0xffffffff, 0x00000001 });
gmp_lib.mpn_mul(rp, s1p, s1p.Size, s2p, s2p.Size);
Assert.IsTrue(rp.SequenceEqual(result));
gmp_lib.free(rp, s1p, s2p, result);
Dim s1p As New mp_ptr(New UInteger() { &HffffffffUI, &HffffffffUI})
Dim s2p As New mp_ptr(New UInteger() { &H2})
Dim rp As New mp_ptr(New UInteger(2) { })
Dim result As New mp_ptr(New UInteger() { &HfffffffeUI, &HffffffffUI, &H1})
gmp_lib.mpn_mul(rp, s1p, s1p.Size, s2p, s2p.Size)
Assert.IsTrue(rp.SequenceEqual(result))
gmp_lib.free(rp, s1p, s2p, result)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also