Back to index

glibc  2.9
Functions
cmp.c File Reference
#include <gmp.h>
#include "gmp-impl.h"

Go to the source code of this file.

Functions

int mpn_cmp (mp_srcptr op1_ptr, mp_srcptr op2_ptr, mp_size_t size)

Function Documentation

int mpn_cmp ( mp_srcptr  op1_ptr,
mp_srcptr  op2_ptr,
mp_size_t  size 
)

Definition at line 34 of file cmp.c.

{
  mp_size_t i;
  mp_limb_t op1_word, op2_word;

  for (i = size - 1; i >= 0; i--)
    {
      op1_word = op1_ptr[i];
      op2_word = op2_ptr[i];
      if (op1_word != op2_word)
       goto diff;
    }
  return 0;
 diff:
  /* This can *not* be simplified to
       op2_word - op2_word
     since that expression might give signed overflow.  */
  return (op1_word > op2_word) ? 1 : -1;
}

Here is the caller graph for this function: