List:Commits« Previous MessageNext Message »
From:Hakan Kuecuekilmaz Date:June 21 2007 12:34am
Subject:bk commit into 6.0-falcon tree (hakank:1.2556)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0-falcon repository of hakan. When hakan does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-06-21 00:34:14+02:00, hakank@stripped +1 -0
  Merge hakank@stripped:/home/bk/mysql-5.1-falcon
  into  au0012.local:/Users/hakan/work/mysql/mysql-5.1-falcon-local-master
  MERGE: 1.2552.1.29

  storage/falcon/BigInt.cpp@stripped, 2007-06-21 00:34:09+02:00, hakank@stripped +0 -0
    Auto merged
    MERGE: 1.13.1.1

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	hakank
# Host:	au0012.local
# Root:	/Users/hakan/work/mysql/mysql-5.1-falcon-local-master/RESYNC

--- 1.14/storage/falcon/BigInt.cpp	2007-06-19 22:11:59 +02:00
+++ 1.15/storage/falcon/BigInt.cpp	2007-06-21 00:34:09 +02:00
@@ -306,7 +306,7 @@ BigInt BigInt::scaleTo(int toScale, BigI
 	if (delta == 0)
 		return *result;
 	
-	if (delta > 9) //cwp handle <= 9
+	if (delta > 9)
 		{
 		*result = divide(powerTable[delta]);
 		return *result;
@@ -525,9 +525,20 @@ BigInt BigInt::divide(const BigInt* divi
 	BigInt quotient;
 	BigInt remainder;
 	
-	divide(this, divisor, &quotient, &remainder);
-	memcpy(this->words, quotient.words, sizeof(this->words));
-	this->length = quotient.length;
+	// If the divisor is larger than the dividend (this), then set the quotient
+	// to 0 return the dividend as the remainder.
+	
+	if (divisor->length > length)
+		{
+		remainder = *this;
+		clear();
+		}
+	else
+		{
+		divide(this, divisor, &quotient, &remainder);
+		memcpy(this->words, quotient.words, sizeof(this->words));
+		this->length = quotient.length;
+		}
 	
 	return(remainder);
 }
@@ -592,15 +603,15 @@ int BigInt::divide(const BigInt* dividen
 	vn = (uint32 *)malloc(4*n);
 
 	for (i = n - 1; i > 0; i--)
-		vn[i] = (v[i] << s) | (v[i-1] >> (MPBASE-s));
+		vn[i] = (v[i] << s) | (uint32)(((uint64)v[i-1]) >> (MPBASE-s));
 
 	vn[0] = v[0] << s;
 
 	un = (uint32 *)malloc(4*(m+1));
-	un[m] = u[m-1] >> (MPBASE-s);
+	un[m] = (uint32)(((uint64)u[m-1]) >> (MPBASE-s));
 
 	for (i = m - 1; i > 0; i--)
-		un[i] = (u[i] << s) | (u[i-1] >> (MPBASE-s));
+		un[i] = (u[i] << s) | (uint32)(((uint64)u[i-1]) >> (MPBASE-s));
 
 	un[0] = u[0] << s;
 
@@ -677,7 +688,7 @@ int BigInt::divide(const BigInt* dividen
 	if (r != NULL)
 		{
 		for (i = 0; i < n; i++)
-			r[i] = (un[i] >> s) | (un[i+1] << (MPBASE-s));
+			r[i] = (un[i] >> s) | (uint32)(((uint64)un[i+1]) << (MPBASE-s));
 		}
 
 	// Take a best guess at the quotient length, adjust as necessary
Thread
bk commit into 6.0-falcon tree (hakank:1.2556)Hakan Kuecuekilmaz20 Jun