Back to index

glibc  2.9
mul_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_mul_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_mul_1 ( mp_ptr  res_ptr,
mp_srcptr  s1_ptr,
mp_size_t  s1_size,
mp_limb_t  s2_limb 

Definition at line 28 of file mul_1.c.

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

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

  /* Offset the base pointers to compensate for the negative indices.  */
  s1_ptr -= j;
  res_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;

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

  return cy_limb;

Here is the caller graph for this function: