summaryrefslogtreecommitdiff
path: root/ext/bigdecimal
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-04 07:32:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-04 07:32:58 +0000
commita44f7a3ee672352781c614e46b91f6212321d561 (patch)
treed4c15e112bbef9947c2a1f6d00aaa6830e4fbcc6 /ext/bigdecimal
parent718b42530626167829d7799efd7819d626c833ca (diff)
bigdecimal.c: format specifiers
* ext/bigdecimal/bigdecimal.c (VpInit, VpPower, VpVarCheck): fix format specifiers of BDIGIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal')
-rw-r--r--ext/bigdecimal/bigdecimal.c14
-rw-r--r--ext/bigdecimal/bigdecimal.h22
2 files changed, 29 insertions, 7 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index ea88eb41c2..07b96df43f 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -3831,10 +3831,10 @@ VpInit(BDIGIT BaseVal)
#ifdef BIGDECIMAL_DEBUG
if (gfDebug) {
- printf("VpInit: BaseVal = %lu\n", BaseVal);
- printf(" BASE = %lu\n", BASE);
- printf(" HALF_BASE = %lu\n", HALF_BASE);
- printf(" BASE1 = %lu\n", BASE1);
+ printf("VpInit: BaseVal = %"PRIuBDIGIT"\n", BaseVal);
+ printf(" BASE = %"PRIuBDIGIT"\n", BASE);
+ printf(" HALF_BASE = %"PRIuBDIGIT"\n", HALF_BASE);
+ printf(" BASE1 = %"PRIuBDIGIT"\n", BASE1);
printf(" BASE_FIG = %u\n", BASE_FIG);
printf(" DBLE_FIG = %d\n", DBLE_FIG);
}
@@ -6261,7 +6261,7 @@ Exit:
if (gfDebug) {
VPrint(stdout, "VpPower y=%\n", y);
VPrint(stdout, "VpPower x=%\n", x);
- printf(" n=%d\n", n);
+ printf(" n=%"PRIdVALUE"\n", n);
}
#endif /* BIGDECIMAL_DEBUG */
VpFree(w2);
@@ -6296,10 +6296,10 @@ VpVarCheck(Real * v)
for (i = 0; i < v->Prec; ++i) {
if (v->frac[i] >= BASE) {
printf("ERROR(VpVarCheck): Illegal fraction\n");
- printf(" Frac[%"PRIuSIZE"]=%lu\n", i, v->frac[i]);
+ printf(" Frac[%"PRIuSIZE"]=%"PRIuBDIGIT"\n", i, v->frac[i]);
printf(" Prec. =%"PRIuSIZE"\n", v->Prec);
printf(" Exp. =%"PRIdVALUE"\n", v->exponent);
- printf(" BASE =%lu\n", BASE);
+ printf(" BASE =%"PRIuBDIGIT"\n", BASE);
return 3;
}
}
diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h
index 9d3e0fcd29..570ca81c0b 100644
--- a/ext/bigdecimal/bigdecimal.h
+++ b/ext/bigdecimal/bigdecimal.h
@@ -43,13 +43,35 @@
# define BDIGIT_DBL uint64_t
# define BDIGIT_DBL_SIGNED int64_t
# define SIZEOF_BDIGITS 4
+# define PRI_BDIGIT_PREFIX ""
+# ifdef PRI_LL_PREFIX
+# define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
+# else
+# define PRI_BDIGIT_DBL_PREFIX "l"
+# endif
#else
# define BDIGIT uint16_t
# define BDIGIT_DBL uint32_t
# define BDIGIT_DBL_SIGNED int32_t
# define SIZEOF_BDIGITS 2
+# define PRI_BDIGIT_PREFIX "h"
+# define PRI_BDIGIT_DBL_PREFIX ""
#endif
+#define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
+#define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
+#define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
+#define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
+#define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
+#define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
+
+#define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
+#define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
+#define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
+#define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
+#define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
+#define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
+
#if defined(__cplusplus)
extern "C" {
#if 0