gmp_lib.mpn_sec_tabselect Method

GMP Native Interface for .NET

gmp_libmpn_sec_tabselect Method
Select entry which from table tab, which has nents entries, each n limbs. Store the selected entry at 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 void mpn_sec_tabselect(
	mp_ptr rp,
	mp_ptr tab,
	mp_size_t n,
	mp_size_t nents,
	mp_size_t which
)
Public Shared Sub mpn_sec_tabselect ( 
	rp As mp_ptr,
	tab As mp_ptr,
	n As mp_size_t,
	nents As mp_size_t,
	which As mp_size_t
)
public:
static void mpn_sec_tabselect(
	mp_ptr^ rp, 
	mp_ptr^ tab, 
	mp_size_t n, 
	mp_size_t nents, 
	mp_size_t which
)
static member mpn_sec_tabselect : 
        rp : mp_ptr * 
        tab : mp_ptr * 
        n : mp_size_t * 
        nents : mp_size_t * 
        which : mp_size_t -> unit 

Parameters

rp
Type: Math.Gmp.Nativemp_ptr
The result integer.
tab
Type: Math.Gmp.Nativemp_ptr
The table of operand integers.
n
Type: Math.Gmp.Nativemp_size_t
The number of limbs in each entry of the table.
nents
Type: Math.Gmp.Nativemp_size_t
The number of entries in the table.
which
Type: Math.Gmp.Nativemp_size_t
The zero-based index of the entry to select.
Remarks

This function reads the entire table to avoid side-channel information leaks.

Examples
// Create multi-precision operands, and expected result.
mp_ptr tab = new mp_ptr(new uint[] { 0x11111111, 0x22222222, 0x33333333, 0x44444444, 0x33333333, 0x00000000 });
mp_ptr result = new mp_ptr(new uint[] { 0x33333333 });
mp_ptr rp = new mp_ptr(result.Size);

// Set rp to third entry in tab.
gmp_lib.mpn_sec_tabselect(rp, tab, 1, tab.Size, 2);

// Assert result of operation.
Assert.IsTrue(rp.SequenceEqual(result));

// Release unmanaged memory.
gmp_lib.free(tab, result);
' Create multi-precision operands, and expected result.
Dim tab As New mp_ptr(New UInteger() { &H11111111, &H22222222, &H33333333, &H44444444, &H33333333, &H0})
Dim result As New mp_ptr(New UInteger() { &H33333333})
Dim rp As New mp_ptr(result.Size)

' Set rp to third entry in tab.
gmp_lib.mpn_sec_tabselect(rp, tab, 1, tab.Size, 2)

' Assert result of operation.
Assert.IsTrue(rp.SequenceEqual(result))

' Release unmanaged memory.
gmp_lib.free(tab, 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