Multiply {s1p, n} by s2limb, and write the n least significant limbs of the product 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_1(
mp_ptr rp,
mp_ptr s1p,
mp_size_t n,
mp_limb_t s2limb
)
Public Shared Function mpn_mul_1 (
rp As mp_ptr,
s1p As mp_ptr,
n As mp_size_t,
s2limb As mp_limb_t
) As mp_limb_t
public:
static mp_limb_t mpn_mul_1(
mp_ptr^ rp,
mp_ptr^ s1p,
mp_size_t n,
mp_limb_t s2limb
)
static member mpn_mul_1 :
rp : mp_ptr *
s1p : mp_ptr *
n : mp_size_t *
s2limb : mp_limb_t -> mp_limb_t
Parameters
- rp
- Type: Math.Gmp.Nativemp_ptr
The result integer. - s1p
- Type: Math.Gmp.Nativemp_ptr
The first operand integer. - n
- Type: Math.Gmp.Nativemp_size_t
The number of limbs of s1p. - s2limb
- Type: Math.Gmp.Nativemp_limb_t
The second operand integer.
Return Value
Type:
mp_limb_tReturn the most significant limb of the product.
Remarks
{s1p, n} and {rp, n}
are allowed to overlap provided rp ≤ s1p.
This is a low-level function that is a building block for general multiplication as well as
other operations in GMP. It is written in assembly for most CPUs.
Don’t call this function if s2limb is a power of 2;
use mpn_lshift with a count equal to the logarithm of
s2limb instead, for optimal speed.
Examples
mp_ptr s1p = new mp_ptr(new uint[] { 0xffffffff, 0xffffffff });
mp_ptr rp = new mp_ptr(new uint[2]);
mp_ptr result = new mp_ptr(new uint[] { 0xfffffffe, 0xffffffff });
mp_limb_t carry = gmp_lib.mpn_mul_1(rp, s1p, s1p.Size, 2);
Assert.IsTrue(carry == 1);
Assert.IsTrue(rp.SequenceEqual(result));
gmp_lib.free(rp, s1p, result);
Dim s1p As New mp_ptr(New UInteger() { &HffffffffUI, &HffffffffUI})
Dim rp As New mp_ptr(New UInteger(1) { })
Dim result As New mp_ptr(New UInteger() { &HfffffffeUI, &HffffffffUI})
Dim carry As mp_limb_t = gmp_lib.mpn_mul_1(rp, s1p, s1p.Size, 2)
Assert.IsTrue(carry = 1)
Assert.IsTrue(rp.SequenceEqual(result))
gmp_lib.free(rp, s1p, 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