Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
mpvalpha.c File Reference
#include "mpi-priv.h"
#include <c_asm.h>

Go to the source code of this file.

Defines

#define MP_MUL_DxD(a, b, Phi, Plo)
#define CARRY_ADD
#define ONE_MUL
#define FOUR_MUL
#define SIXTEEN_MUL
#define THIRTYTWO_MUL
#define ONETWENTYEIGHT_MUL
#define EXPAND_256(CALL)
#define FUNC_NAME(NAME)
#define DECLARE_MUL_256(FNAME)
#define DO_NOT_EXPAND   1
#define CARRY_ADD

Functions

void s_mpv_mul_d (const mp_digit *a, mp_size a_len, mp_digit b, mp_digit *c)
 FUNC_NAME (s_mpv_mul_d_add_MUL256)
void s_mpv_mul_d_add (const mp_digit *a, mp_size a_len, mp_digit b, mp_digit *c)
void s_mpv_mul_d_add_prop (const mp_digit *a, mp_size a_len, mp_digit b, mp_digit *c)

Define Documentation

Definition at line 181 of file mpvalpha.c.

Value:
a0b0 += a_i = *c;                  \
    if (a0b0 < a_i)                \
      ++a1b1;                      \

Definition at line 181 of file mpvalpha.c.

#define DECLARE_MUL_256 (   FNAME)
Value:
FUNC_NAME(FNAME)                   \
{                                  \
  mp_digit a_i;                           \
  mp_digit a0b0, a1b1;                    \
  while (a_len) {                  \
       ONETWENTYEIGHT_MUL          \
       ONETWENTYEIGHT_MUL          \
       a_len-= 256;                \
  }                                \
  return carry;                           \
}                                  \

Definition at line 127 of file mpvalpha.c.

Definition at line 143 of file mpvalpha.c.

#define EXPAND_256 (   CALL)

Definition at line 82 of file mpvalpha.c.

Value:
ONE_MUL                            \
       ONE_MUL                            \
       ONE_MUL                            \
       ONE_MUL                            \

Definition at line 59 of file mpvalpha.c.

Value:
mp_digit NAME(const mp_digit *a,   \
       mp_size a_len,                     \
       mp_digit b, mp_digit *c,    \
       mp_digit carry)                    \

Definition at line 121 of file mpvalpha.c.

#define MP_MUL_DxD (   a,
  b,
  Phi,
  Plo 
)
Value:
{ Plo = asm ("mulq %a0, %a1, %v0", a, b); \
   Phi = asm ("umulh %a0, %a1, %v0", a, b); }    \

Definition at line 42 of file mpvalpha.c.

Value:
a_i = *a++;                        \
    MP_MUL_DxD(a_i, b, a1b1, a0b0);       \
    a0b0 += carry;                 \
    if (a0b0 < carry)                     \
      ++a1b1;                      \
    CARRY_ADD                      \
    *c++ = a0b0;                   \
    carry = a1b1;                  \

Definition at line 49 of file mpvalpha.c.

Value:
THIRTYTWO_MUL               \
       THIRTYTWO_MUL               \
       THIRTYTWO_MUL               \
       THIRTYTWO_MUL               \

Definition at line 75 of file mpvalpha.c.

Value:
FOUR_MUL                    \
       FOUR_MUL                    \
       FOUR_MUL                    \
       FOUR_MUL                    \

Definition at line 65 of file mpvalpha.c.

Value:
SIXTEEN_MUL                 \
       SIXTEEN_MUL                 \

Definition at line 71 of file mpvalpha.c.


Function Documentation

FUNC_NAME ( s_mpv_mul_d_add_MUL256  )
void s_mpv_mul_d ( const mp_digit a,
mp_size  a_len,
mp_digit  b,
mp_digit c 
)

Definition at line 152 of file mpvalpha.c.

{
#if defined(DO_NOT_EXPAND)
  mp_digit carry = 0;
  while (a_len--) {
    mp_digit a_i = *a++;
    mp_digit a0b0, a1b1;

    MP_MUL_DxD(a_i, b, a1b1, a0b0);

    a0b0 += carry;
    if (a0b0 < carry)
      ++a1b1;
    *c++ = a0b0;
    carry = a1b1;
  }
#else
  EXPAND_256(s_mpv_mul_d_MUL256)
#endif
  *c = carry;
}

Here is the caller graph for this function:

void s_mpv_mul_d_add ( const mp_digit a,
mp_size  a_len,
mp_digit  b,
mp_digit c 
)

Definition at line 191 of file mpvalpha.c.

{
  EXPAND_256(s_mpv_mul_d_add_MUL256)
  *c = carry;
}

Here is the caller graph for this function:

void s_mpv_mul_d_add_prop ( const mp_digit a,
mp_size  a_len,
mp_digit  b,
mp_digit c 
)

Definition at line 203 of file mpvalpha.c.

{
  EXPAND_256(s_mpv_mul_d_add_MUL256)
  while (carry) {
    mp_digit c_i = *c;
    carry += c_i;
    *c++ = carry;
    carry = carry < c_i;
  }
}

Here is the caller graph for this function: