diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-07-21 16:39:19 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-07-21 16:39:19 +0200 |
commit | b7b5f6f1ab49948b0e15b762266d4640b3d6b7fb (patch) | |
tree | 7c302c2025184dbd053aa6135f0ff28c8ce6f359 /strings/decimal.c | |
parent | 5f6380adde2dac3f32b40339b9b702c0135eb7d6 (diff) | |
parent | c1d6a2d7e194225ccc19a68ea5d0f368632620d0 (diff) | |
download | mariadb-git-b7b5f6f1ab49948b0e15b762266d4640b3d6b7fb.tar.gz |
10.0-monty merge
includes:
* remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING"
* introduce LOCK_share, now LOCK_ha_data is strictly for engines
* rea_create_table() always creates .par file (even in "frm-only" mode)
* fix a 5.6 bug, temp file leak on dummy ALTER TABLE
Diffstat (limited to 'strings/decimal.c')
-rw-r--r-- | strings/decimal.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/strings/decimal.c b/strings/decimal.c index 30cc3c30428..6d39d9aec78 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -396,7 +396,7 @@ int decimal2string(const decimal_t *from, char *to, int *to_len, for (; frac>0; frac-=DIG_PER_DEC1) { dec1 x=*buf++; - for (i=min(frac, DIG_PER_DEC1); i; i--) + for (i=MY_MIN(frac, DIG_PER_DEC1); i; i--) { dec1 y=x/DIG_MASK; *s1++='0'+(uchar)y; @@ -419,7 +419,7 @@ int decimal2string(const decimal_t *from, char *to, int *to_len, for (buf=buf0+ROUND_UP(intg); intg>0; intg-=DIG_PER_DEC1) { dec1 x=*--buf; - for (i=min(intg, DIG_PER_DEC1); i; i--) + for (i=MY_MIN(intg, DIG_PER_DEC1); i; i--) { dec1 y=x/10; *--s='0'+(uchar)(x-y*10); @@ -1513,8 +1513,8 @@ decimal_round(const decimal_t *from, decimal_t *to, int scale, if (to != from) { - dec1 *p0= buf0+intg0+max(frac1, frac0); - dec1 *p1= buf1+intg0+max(frac1, frac0); + dec1 *p0= buf0+intg0+MY_MAX(frac1, frac0); + dec1 *p1= buf1+intg0+MY_MAX(frac1, frac0); DBUG_ASSERT(p0 - buf0 <= len); DBUG_ASSERT(p1 - buf1 <= len); @@ -1525,7 +1525,7 @@ decimal_round(const decimal_t *from, decimal_t *to, int scale, buf0=to->buf; buf1=to->buf; to->sign=from->sign; - to->intg=min(intg0, len)*DIG_PER_DEC1; + to->intg=MY_MIN(intg0, len)*DIG_PER_DEC1; } if (frac0 > frac1) @@ -1627,7 +1627,7 @@ decimal_round(const decimal_t *from, decimal_t *to, int scale, scale=frac0*DIG_PER_DEC1; error=E_DEC_TRUNCATED; /* XXX */ } - for (buf1=to->buf+intg0+max(frac0,0); buf1 > to->buf; buf1--) + for (buf1=to->buf+intg0+MY_MAX(frac0,0); buf1 > to->buf; buf1--) { buf1[0]=buf1[-1]; } @@ -1646,7 +1646,7 @@ decimal_round(const decimal_t *from, decimal_t *to, int scale, /* making 'zero' with the proper scale */ dec1 *p0= to->buf + frac0 + 1; to->intg=1; - to->frac= max(scale, 0); + to->frac= MY_MAX(scale, 0); to->sign= 0; for (buf1= to->buf; buf1<p0; buf1++) *buf1= 0; @@ -1695,11 +1695,11 @@ int decimal_result_size(decimal_t *from1, decimal_t *from2, char op, int param) { switch (op) { case '-': - return ROUND_UP(max(from1->intg, from2->intg)) + - ROUND_UP(max(from1->frac, from2->frac)); + return ROUND_UP(MY_MAX(from1->intg, from2->intg)) + + ROUND_UP(MY_MAX(from1->frac, from2->frac)); case '+': - return ROUND_UP(max(from1->intg, from2->intg)+1) + - ROUND_UP(max(from1->frac, from2->frac)); + return ROUND_UP(MY_MAX(from1->intg, from2->intg)+1) + + ROUND_UP(MY_MAX(from1->frac, from2->frac)); case '*': return ROUND_UP(from1->intg+from2->intg)+ ROUND_UP(from1->frac)+ROUND_UP(from2->frac); @@ -1714,7 +1714,7 @@ static int do_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to) { int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg), frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac), - frac0=max(frac1, frac2), intg0=max(intg1, intg2), error; + frac0=MY_MAX(frac1, frac2), intg0=MY_MAX(intg1, intg2), error; dec1 *buf1, *buf2, *buf0, *stop, *stop2, x, carry; sanity(to); @@ -1739,7 +1739,7 @@ static int do_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to) buf0=to->buf+intg0+frac0; to->sign=from1->sign; - to->frac=max(from1->frac, from2->frac); + to->frac=MY_MAX(from1->frac, from2->frac); to->intg=intg0*DIG_PER_DEC1; if (unlikely(error)) { @@ -1750,7 +1750,7 @@ static int do_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to) set_if_smaller(intg2, intg0); } - /* part 1 - max(frac) ... min (frac) */ + /* part 1 - MY_MAX(frac) ... min (frac) */ if (frac1 > frac2) { buf1=from1->buf+intg1+frac1; @@ -1768,14 +1768,14 @@ static int do_add(const decimal_t *from1, const decimal_t *from2, decimal_t *to) while (buf1 > stop) *--buf0=*--buf1; - /* part 2 - min(frac) ... min(intg) */ + /* part 2 - MY_MIN(frac) ... MY_MIN(intg) */ carry=0; while (buf1 > stop2) { ADD(*--buf0, *--buf1, *--buf2, carry); } - /* part 3 - min(intg) ... max(intg) */ + /* part 3 - MY_MIN(intg) ... MY_MAX(intg) */ buf1= intg1 > intg2 ? ((stop=from1->buf)+intg1-intg2) : ((stop=from2->buf)+intg2-intg1) ; while (buf1 > stop) @@ -1796,7 +1796,7 @@ static int do_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to) { int intg1=ROUND_UP(from1->intg), intg2=ROUND_UP(from2->intg), frac1=ROUND_UP(from1->frac), frac2=ROUND_UP(from2->frac); - int frac0=max(frac1, frac2), error; + int frac0=MY_MAX(frac1, frac2), error; dec1 *buf1, *buf2, *buf0, *stop1, *stop2, *start1, *start2; my_bool carry=0; @@ -1872,7 +1872,7 @@ static int do_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to) FIX_INTG_FRAC_ERROR(to->len, intg1, frac0, error); buf0=to->buf+intg1+frac0; - to->frac=max(from1->frac, from2->frac); + to->frac=MY_MAX(from1->frac, from2->frac); to->intg=intg1*DIG_PER_DEC1; if (unlikely(error)) { @@ -1883,7 +1883,7 @@ static int do_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to) } carry=0; - /* part 1 - max(frac) ... min (frac) */ + /* part 1 - MY_MAX(frac) ... min (frac) */ if (frac1 > frac2) { buf1=start1+intg1+frac1; @@ -1907,7 +1907,7 @@ static int do_sub(const decimal_t *from1, const decimal_t *from2, decimal_t *to) } } - /* part 2 - min(frac) ... intg2 */ + /* part 2 - MY_MIN(frac) ... intg2 */ while (buf2 > start2) { SUB(*--buf0, *--buf1, *--buf2, carry); @@ -2170,11 +2170,11 @@ static int do_div_mod(const decimal_t *from1, const decimal_t *from2, { /* we're calculating N1 % N2. The result will have - frac=max(frac1, frac2), as for subtraction + frac=MY_MAX(frac1, frac2), as for subtraction intg=intg2 */ to->sign=from1->sign; - to->frac=max(from1->frac, from2->frac); + to->frac=MY_MAX(from1->frac, from2->frac); frac0=0; } else @@ -2307,7 +2307,7 @@ static int do_div_mod(const decimal_t *from1, const decimal_t *from2, /* now the result is in tmp1, it has intg=prec1-frac1 - frac=max(frac1, frac2)=to->frac + frac=MY_MAX(frac1, frac2)=to->frac */ if (dcarry) *--start1=dcarry; @@ -2345,7 +2345,7 @@ static int do_div_mod(const decimal_t *from1, const decimal_t *from2, } DBUG_ASSERT(intg0 <= ROUND_UP(from2->intg)); stop1=start1+frac0+intg0; - to->intg=min(intg0*DIG_PER_DEC1, from2->intg); + to->intg=MY_MIN(intg0*DIG_PER_DEC1, from2->intg); } if (unlikely(intg0+frac0 > to->len)) { |