summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-10-07 10:53:43 +0200
committerSergei Golubchik <sergii@pisem.net>2014-10-07 10:53:43 +0200
commitd2e808025aec75fbb0ee37935a862d137a03a9c3 (patch)
tree55fb94cdb7090e413999b5dbdcbfe438b53702e9 /strings
parent7989c62bc0c4b74f866367cc9337444913178a0d (diff)
downloadmariadb-git-d2e808025aec75fbb0ee37935a862d137a03a9c3.tar.gz
fixes for decimal type
Diffstat (limited to 'strings')
-rw-r--r--strings/decimal.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index 49b12f14dbf..8d6877a24ec 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -127,7 +127,6 @@ typedef longlong dec2;
#define DIG_BASE 1000000000
#define DIG_MAX (DIG_BASE-1)
#define DIG_BASE2 ((dec2)DIG_BASE * (dec2)DIG_BASE)
-#define ROUND_UP(X) (((X)+DIG_PER_DEC1-1)/DIG_PER_DEC1)
static const dec1 powers10[DIG_PER_DEC1+1]={
1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};
static const int dig2bytes[DIG_PER_DEC1+1]={0, 1, 1, 2, 2, 3, 3, 4, 4, 4};
@@ -136,6 +135,11 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={
999900000, 999990000, 999999000,
999999900, 999999990 };
+static inline int ROUND_UP(int x)
+{
+ return (x + (x > 0 ? 1 : -1) * (DIG_PER_DEC1 - 1)) / DIG_PER_DEC1;
+}
+
#ifdef HAVE_valgrind
#define sanity(d) DBUG_ASSERT((d)->len > 0)
#else