[BACK]Return to xor.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpz

Diff for /OpenXM_contrib/gmp/mpz/Attic/xor.c between version 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2000/09/09 14:13:00 version 1.1.1.2, 2003/08/25 16:06:34
Line 1 
Line 1 
 /* mpz_xor -- Logical xor.  /* mpz_xor -- Logical xor.
   
 Copyright (C) 1991, 1993, 1994, 1996, 1997, 2000 Free Software Foundation,  Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001 Free Software Foundation,
 Inc.  Inc.
   
 This file is part of the GNU MP Library.  This file is part of the GNU MP Library.
Line 24  MA 02111-1307, USA. */
Line 24  MA 02111-1307, USA. */
 #include "gmp-impl.h"  #include "gmp-impl.h"
   
 void  void
 #if __STDC__  
 mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)  mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
 #else  
 mpz_xor (res, op1, op2)  
      mpz_ptr res;  
      mpz_srcptr op1;  
      mpz_srcptr op2;  
 #endif  
 {  {
   mp_srcptr op1_ptr, op2_ptr;    mp_srcptr op1_ptr, op2_ptr;
   mp_size_t op1_size, op2_size;    mp_size_t op1_size, op2_size;
Line 101  mpz_xor (res, op1, op2)
Line 94  mpz_xor (res, op1, op2)
       if (op2_size < 0)        if (op2_size < 0)
         {          {
           mp_ptr opx;            mp_ptr opx;
           mp_limb_t cy;  
   
           /* Both operands are negative, the result will be positive.            /* Both operands are negative, the result will be positive.
               (-OP1) ^ (-OP2) =                (-OP1) ^ (-OP2) =
Line 165  mpz_xor (res, op1, op2)
Line 157  mpz_xor (res, op1, op2)
   {    {
     mp_ptr opx;      mp_ptr opx;
     mp_limb_t cy;      mp_limb_t cy;
     mp_size_t count;  
   
     /* Operand 2 negative, so will be the result.      /* Operand 2 negative, so will be the result.
        -(OP1 ^ (-OP2)) = -(OP1 ^ ~(OP2 - 1)) =         -(OP1 ^ (-OP2)) = -(OP1 ^ ~(OP2 - 1)) =

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>