summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <holyfoot@mysql.com>2005-05-06 20:31:50 +0500
committerunknown <holyfoot@mysql.com>2005-05-06 20:31:50 +0500
commit843b47b16b8837ef965753aaf9b5a6ac8bce4038 (patch)
treed684134ac76e93135636559954c94390e744a8f2 /strings
parentf1def25a89e3dc2ed191335e9d5f7843de245e0a (diff)
parentf98913819bffa336adb737b19b8bc22cae0c68e6 (diff)
downloadmariadb-git-843b47b16b8837ef965753aaf9b5a6ac8bce4038.tar.gz
merging
strings/decimal.c: Auto merged
Diffstat (limited to 'strings')
-rw-r--r--strings/decimal.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index b06a50fc86b..7459b2f7dda 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1709,19 +1709,23 @@ static int do_sub(decimal_t *from1, decimal_t *from2, decimal_t *to)
carry=1;
else if (intg2 == intg1)
{
- while (unlikely(stop1[frac1-1] == 0))
- frac1--;
- while (unlikely(stop2[frac2-1] == 0))
- frac2--;
- while (buf1 < stop1+frac1 && buf2 < stop2+frac2 && *buf1 == *buf2)
+ dec1 *end1= stop1 + (frac1 - 1);
+ dec1 *end2= stop2 + (frac2 - 1);
+ while (unlikely((buf1 <= end1) && (*end1 == 0)))
+ end1--;
+ while (unlikely((buf2 <= end2) && (*end2 == 0)))
+ end2--;
+ frac1= (end1 - stop1) + 1;
+ frac2= (end2 - stop2) + 1;
+ while (buf1 <=end1 && buf2 <= end2 && *buf1 == *buf2)
buf1++, buf2++;
- if (buf1 < stop1+frac1)
- if (buf2 < stop2+frac2)
+ if (buf1 <= end1)
+ if (buf2 <= end2)
carry= *buf2 > *buf1;
else
carry= 0;
else
- if (buf2 < stop2+frac2)
+ if (buf2 <= end2)
carry=1;
else /* short-circuit everything: from1 == from2 */
{