Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Functions
jau::mp::ops Namespace Reference

Functions

void basecase_mul (mp_word_t z[], size_t z_size, const mp_word_t x[], size_t x_size, const mp_word_t y[], size_t y_size) noexcept
 
mp_word_t bigint_add2 (mp_word_t x[], size_t x_size, const mp_word_t y[], size_t y_size) noexcept
 Two operand addition with carry out. More...
 
void bigint_add3 (mp_word_t z[], const mp_word_t x[], size_t x_size, const mp_word_t y[], size_t y_size) noexcept
 Three operand addition. More...
 
mp_word_t bigint_add3_nc (mp_word_t z[], const mp_word_t x[], size_t x_size, const mp_word_t y[], size_t y_size) noexcept
 Three operand addition with carry out. More...
 
int bigint_cmp (const mp_word_t x[], size_t x_size, const mp_word_t y[], size_t y_size) noexcept
 Compare unsigned x and y mp_word_t. More...
 
CT::Mask< mp_word_tbigint_ct_is_eq (const mp_word_t x[], size_t x_size, const mp_word_t y[], size_t y_size) noexcept
 
CT::Mask< mp_word_tbigint_ct_is_lt (const mp_word_t x[], size_t x_size, const mp_word_t y[], size_t y_size, bool lt_or_equal=false) noexcept
 Compare x and y Return ~0 if x[0:x_size] < y[0:y_size] or 0 otherwise If lt_or_equal is true, returns ~0 also for x == y. More...
 
mp_word_t bigint_divop (mp_word_t n1, mp_word_t n0, mp_word_t d)
 Computes ((n1<<bits) + n0) / d. More...
 
mp_word_t bigint_linmul2 (mp_word_t x[], size_t x_size, mp_word_t y) noexcept
 
void bigint_linmul3 (mp_word_t z[], const mp_word_t x[], size_t x_size, mp_word_t y) noexcept
 
mp_word_t bigint_modop (mp_word_t n1, mp_word_t n0, mp_word_t d)
 Compute ((n1<<bits) + n0) % d. More...
 
void bigint_shl1 (mp_word_t x[], size_t x_size, size_t x_words, size_t word_shift, size_t bit_shift) noexcept
 
void bigint_shl2 (mp_word_t y[], const mp_word_t x[], size_t x_size, size_t word_shift, size_t bit_shift) noexcept
 
void bigint_shr1 (mp_word_t x[], size_t x_size, size_t word_shift, size_t bit_shift) noexcept
 
void bigint_shr2 (mp_word_t y[], const mp_word_t x[], size_t x_size, size_t word_shift, size_t bit_shift) noexcept
 
mp_word_t bigint_sub2 (mp_word_t x[], size_t x_size, const mp_word_t y[], size_t y_size) noexcept
 Two operand subtraction. More...
 
void bigint_sub2_rev (mp_word_t x[], const mp_word_t y[], size_t y_size) noexcept
 Two operand subtraction, x = y - x; assumes y >= x. More...
 
mp_word_t bigint_sub3 (mp_word_t z[], const mp_word_t x[], size_t x_size, const mp_word_t y[], size_t y_size) noexcept
 Three operand subtraction. More...
 
int32_t bigint_sub_abs (mp_word_t z[], const mp_word_t x[], size_t x_size, const mp_word_t y[], size_t y_size) noexcept
 Set z to abs(x-y), ie if x >= y, then compute z = x - y Otherwise compute z = y - x No borrow is possible since the result is always >= 0. More...
 
void mul64x64_128 (const uint64_t a, const uint64_t b, uint64_t &lo, uint64_t &hi) noexcept
 64x64->128 bit multiplication More...
 
mp_word_t word8_add2 (mp_word_t x[8], const mp_word_t y[8], mp_word_t carry) noexcept
 
mp_word_t word8_add3 (mp_word_t z[8], const mp_word_t x[8], const mp_word_t y[8], mp_word_t carry) noexcept
 
mp_word_t word8_linmul2 (mp_word_t x[8], mp_word_t y, mp_word_t carry) noexcept
 
mp_word_t word8_linmul3 (mp_word_t z[8], const mp_word_t x[8], mp_word_t y, mp_word_t carry) noexcept
 
mp_word_t word8_madd3 (mp_word_t z[8], const mp_word_t x[8], mp_word_t y, mp_word_t carry) noexcept
 
mp_word_t word8_sub2 (mp_word_t x[8], const mp_word_t y[8], mp_word_t carry) noexcept
 
mp_word_t word8_sub2_rev (mp_word_t x[8], const mp_word_t y[8], mp_word_t carry) noexcept
 
mp_word_t word8_sub3 (mp_word_t z[8], const mp_word_t x[8], const mp_word_t y[8], mp_word_t carry) noexcept
 
mp_word_t word_add (const mp_word_t x, const mp_word_t y, mp_word_t &carry) noexcept
 
mp_word_t word_madd2 (mp_word_t a, mp_word_t b, mp_word_t &c) noexcept
 Word Multiply/Add. More...
 
mp_word_t word_madd3 (mp_word_t a, mp_word_t b, mp_word_t c, mp_word_t &d) noexcept
 Word Multiply/Add. More...
 
mp_word_t word_sub (mp_word_t x, mp_word_t y, mp_word_t &carry) noexcept
 

Function Documentation

◆ bigint_cmp()

int jau::mp::ops::bigint_cmp ( const mp_word_t  x[],
size_t  x_size,
const mp_word_t  y[],
size_t  y_size 
)
inlinenoexcept

Compare unsigned x and y mp_word_t.

Returns

  • -1 if x < y
  • 0 if x == y
  • 1 if x > y

Definition at line 645 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word_add()

mp_word_t jau::mp::ops::word_add ( const mp_word_t  x,
const mp_word_t  y,
mp_word_t carry 
)
inlinenoexcept

Definition at line 67 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word8_add2()

mp_word_t jau::mp::ops::word8_add2 ( mp_word_t  x[8],
const mp_word_t  y[8],
mp_word_t  carry 
)
inlinenoexcept

Definition at line 75 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word8_add3()

mp_word_t jau::mp::ops::word8_add3 ( mp_word_t  z[8],
const mp_word_t  x[8],
const mp_word_t  y[8],
mp_word_t  carry 
)
inlinenoexcept

Definition at line 87 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word_sub()

mp_word_t jau::mp::ops::word_sub ( mp_word_t  x,
mp_word_t  y,
mp_word_t carry 
)
inlinenoexcept

Definition at line 100 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word8_sub2()

mp_word_t jau::mp::ops::word8_sub2 ( mp_word_t  x[8],
const mp_word_t  y[8],
mp_word_t  carry 
)
inlinenoexcept

Definition at line 108 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word8_sub2_rev()

mp_word_t jau::mp::ops::word8_sub2_rev ( mp_word_t  x[8],
const mp_word_t  y[8],
mp_word_t  carry 
)
inlinenoexcept

Definition at line 120 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word8_sub3()

mp_word_t jau::mp::ops::word8_sub3 ( mp_word_t  z[8],
const mp_word_t  x[8],
const mp_word_t  y[8],
mp_word_t  carry 
)
inlinenoexcept

Definition at line 132 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ mul64x64_128()

void jau::mp::ops::mul64x64_128 ( const uint64_t  a,
const uint64_t  b,
uint64_t &  lo,
uint64_t &  hi 
)
inlinenoexcept

64x64->128 bit multiplication

Definition at line 145 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word_madd2()

mp_word_t jau::mp::ops::word_madd2 ( mp_word_t  a,
mp_word_t  b,
mp_word_t c 
)
inlinenoexcept

Word Multiply/Add.

Definition at line 184 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word_madd3()

mp_word_t jau::mp::ops::word_madd3 ( mp_word_t  a,
mp_word_t  b,
mp_word_t  c,
mp_word_t d 
)
inlinenoexcept

Word Multiply/Add.

Definition at line 206 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word8_madd3()

mp_word_t jau::mp::ops::word8_madd3 ( mp_word_t  z[8],
const mp_word_t  x[8],
mp_word_t  y,
mp_word_t  carry 
)
inlinenoexcept

Definition at line 233 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word8_linmul2()

mp_word_t jau::mp::ops::word8_linmul2 ( mp_word_t  x[8],
mp_word_t  y,
mp_word_t  carry 
)
inlinenoexcept

Definition at line 248 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ word8_linmul3()

mp_word_t jau::mp::ops::word8_linmul3 ( mp_word_t  z[8],
const mp_word_t  x[8],
mp_word_t  y,
mp_word_t  carry 
)
inlinenoexcept

Definition at line 263 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ bigint_add2()

mp_word_t jau::mp::ops::bigint_add2 ( mp_word_t  x[],
size_t  x_size,
const mp_word_t  y[],
size_t  y_size 
)
inlinenoexcept

Two operand addition with carry out.

Definition at line 276 of file big_int_ops.hpp.

◆ bigint_add3_nc()

mp_word_t jau::mp::ops::bigint_add3_nc ( mp_word_t  z[],
const mp_word_t  x[],
size_t  x_size,
const mp_word_t  y[],
size_t  y_size 
)
inlinenoexcept

Three operand addition with carry out.

Definition at line 296 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ bigint_add3()

void jau::mp::ops::bigint_add3 ( mp_word_t  z[],
const mp_word_t  x[],
size_t  x_size,
const mp_word_t  y[],
size_t  y_size 
)
inlinenoexcept

Three operand addition.

Definition at line 316 of file big_int_ops.hpp.

◆ bigint_sub2()

mp_word_t jau::mp::ops::bigint_sub2 ( mp_word_t  x[],
size_t  x_size,
const mp_word_t  y[],
size_t  y_size 
)
inlinenoexcept

Two operand subtraction.

Definition at line 322 of file big_int_ops.hpp.

◆ bigint_sub2_rev()

void jau::mp::ops::bigint_sub2_rev ( mp_word_t  x[],
const mp_word_t  y[],
size_t  y_size 
)
inlinenoexcept

Two operand subtraction, x = y - x; assumes y >= x.

Definition at line 342 of file big_int_ops.hpp.

◆ bigint_sub3()

mp_word_t jau::mp::ops::bigint_sub3 ( mp_word_t  z[],
const mp_word_t  x[],
size_t  x_size,
const mp_word_t  y[],
size_t  y_size 
)
inlinenoexcept

Three operand subtraction.

Definition at line 357 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ bigint_sub_abs()

int32_t jau::mp::ops::bigint_sub_abs ( mp_word_t  z[],
const mp_word_t  x[],
size_t  x_size,
const mp_word_t  y[],
size_t  y_size 
)
inlinenoexcept

Set z to abs(x-y), ie if x >= y, then compute z = x - y Otherwise compute z = y - x No borrow is possible since the result is always >= 0.

Return the relative size of x vs y (-1, 0, 1)

Parameters
zoutput array of max(x_size,y_size) words
xinput param
x_sizelength of x
yinput param
y_sizelength of y

Definition at line 390 of file big_int_ops.hpp.

◆ bigint_linmul2()

mp_word_t jau::mp::ops::bigint_linmul2 ( mp_word_t  x[],
size_t  x_size,
mp_word_t  y 
)
inlinenoexcept

Definition at line 413 of file big_int_ops.hpp.

◆ bigint_linmul3()

void jau::mp::ops::bigint_linmul3 ( mp_word_t  z[],
const mp_word_t  x[],
size_t  x_size,
mp_word_t  y 
)
inlinenoexcept

Definition at line 427 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ bigint_shl1()

void jau::mp::ops::bigint_shl1 ( mp_word_t  x[],
size_t  x_size,
size_t  x_words,
size_t  word_shift,
size_t  bit_shift 
)
inlinenoexcept

Definition at line 441 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ bigint_shr1()

void jau::mp::ops::bigint_shr1 ( mp_word_t  x[],
size_t  x_size,
size_t  word_shift,
size_t  bit_shift 
)
inlinenoexcept

Definition at line 456 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ bigint_shl2()

void jau::mp::ops::bigint_shl2 ( mp_word_t  y[],
const mp_word_t  x[],
size_t  x_size,
size_t  word_shift,
size_t  bit_shift 
)
inlinenoexcept

Definition at line 475 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ bigint_shr2()

void jau::mp::ops::bigint_shr2 ( mp_word_t  y[],
const mp_word_t  x[],
size_t  x_size,
size_t  word_shift,
size_t  bit_shift 
)
inlinenoexcept

Definition at line 488 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ basecase_mul()

void jau::mp::ops::basecase_mul ( mp_word_t  z[],
size_t  z_size,
const mp_word_t  x[],
size_t  x_size,
const mp_word_t  y[],
size_t  y_size 
)
noexcept

Definition at line 508 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ bigint_divop()

mp_word_t jau::mp::ops::bigint_divop ( mp_word_t  n1,
mp_word_t  n0,
mp_word_t  d 
)
inline

Computes ((n1<<bits) + n0) / d.

Definition at line 534 of file big_int_ops.hpp.

Here is the caller graph for this function:

◆ bigint_modop()

mp_word_t jau::mp::ops::bigint_modop ( mp_word_t  n1,
mp_word_t  n0,
mp_word_t  d 
)
inline

Compute ((n1<<bits) + n0) % d.

Definition at line 561 of file big_int_ops.hpp.

◆ bigint_ct_is_eq()

CT::Mask< mp_word_t > jau::mp::ops::bigint_ct_is_eq ( const mp_word_t  x[],
size_t  x_size,
const mp_word_t  y[],
size_t  y_size 
)
inlinenoexcept

Definition at line 576 of file big_int_ops.hpp.

◆ bigint_ct_is_lt()

CT::Mask< mp_word_t > jau::mp::ops::bigint_ct_is_lt ( const mp_word_t  x[],
size_t  x_size,
const mp_word_t  y[],
size_t  y_size,
bool  lt_or_equal = false 
)
inlinenoexcept

Compare x and y Return ~0 if x[0:x_size] < y[0:y_size] or 0 otherwise If lt_or_equal is true, returns ~0 also for x == y.

Definition at line 604 of file big_int_ops.hpp.