Back to index

glibc  2.9
addmul_1.c File Reference
#include <gmp.h>
#include "gmp-impl.h"
#include "longlong.h"

Go to the source code of this file.


mp_limb_t mpn_addmul_1 (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_size_t s1_size, mp_limb_t s2_limb)

Function Documentation

mp_limb_t mpn_addmul_1 ( mp_ptr  res_ptr,
mp_srcptr  s1_ptr,
mp_size_t  s1_size,
mp_limb_t  s2_limb 

Definition at line 30 of file addmul_1.c.

  register mp_limb_t cy_limb;
  register mp_size_t j;
  register mp_limb_t prod_high, prod_low;
  register mp_limb_t x;

  /* The loop counter and index J goes from -SIZE to -1.  This way
     the loop becomes faster.  */
  j = -s1_size;

  /* Offset the base pointers to compensate for the negative indices.  */
  res_ptr -= j;
  s1_ptr -= j;

  cy_limb = 0;
      umul_ppmm (prod_high, prod_low, s1_ptr[j], s2_limb);

      prod_low += cy_limb;
      cy_limb = (prod_low < cy_limb) + prod_high;

      x = res_ptr[j];
      prod_low = x + prod_low;
      cy_limb += (prod_low < x);
      res_ptr[j] = prod_low;
  while (++j != 0);

  return cy_limb;

Here is the caller graph for this function: