summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/bigdecimal.h
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-10 07:49:15 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-10 07:49:15 +0000
commit8e1293730e372b0cb5ebad818129f7bbe295477d (patch)
tree24475b84998b3b32f36c109f7a671fe6998bd9ef /ext/bigdecimal/bigdecimal.h
parent2dd993072efcf24cf95ed65d5a021cb73ea8d443 (diff)
bigdecimal: import version 1.3.0.pre
Import bigdecimal version 1.3.0.pre. The full commit log of this changes can be found at: https://github.com/ruby/bigdecimal/compare/5c43a9e...v1.3.0.pre git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/bigdecimal.h')
-rw-r--r--ext/bigdecimal/bigdecimal.h56
1 files changed, 53 insertions, 3 deletions
diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h
index f85c3e55adf..fcfeb9c3c3d 100644
--- a/ext/bigdecimal/bigdecimal.h
+++ b/ext/bigdecimal/bigdecimal.h
@@ -90,6 +90,56 @@ llabs(LONG_LONG const x)
}
#endif
+#ifndef HAVE_FINITE
+static int
+finite(double)
+{
+ return !isnan(n) && !isinf(n);
+}
+#endif
+
+#ifndef isfinite
+# ifndef HAVE_ISFINITE
+# define HAVE_ISFINITE 1
+# define isfinite(x) finite(x)
+# endif
+#endif
+
+#ifndef FIX_CONST_VALUE_PTR
+# if defined(__fcc__) || defined(__fcc_version) || \
+ defined(__FCC__) || defined(__FCC_VERSION)
+/* workaround for old version of Fujitsu C Compiler (fcc) */
+# define FIX_CONST_VALUE_PTR(x) ((const VALUE *)(x))
+# else
+# define FIX_CONST_VALUE_PTR(x) (x)
+# endif
+#endif
+
+#ifndef HAVE_RB_ARRAY_CONST_PTR
+static inline const VALUE *
+rb_array_const_ptr(VALUE a)
+{
+ return FIX_CONST_VALUE_PTR((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ?
+ RARRAY(a)->as.ary : RARRAY(a)->as.heap.ptr);
+}
+#endif
+
+#ifndef RARRAY_CONST_PTR
+# define RARRAY_CONST_PTR(a) rb_array_const_ptr(a)
+#endif
+
+#ifndef RARRAY_AREF
+# define RARRAY_AREF(a, i) (RARRAY_CONST_PTR(a)[i])
+#endif
+
+#ifndef HAVE_RB_SYM2STR
+static inline VALUE
+rb_sym2str(VALUE sym)
+{
+ return rb_id2str(SYM2ID(sym));
+}
+#endif
+
#ifdef vabs
# undef vabs
#endif
@@ -182,11 +232,11 @@ extern VALUE rb_cBigDecimal;
typedef struct {
VALUE obj; /* Back pointer(VALUE) for Ruby object. */
size_t MaxPrec; /* Maximum precision size */
- /* This is the actual size of pfrac[] */
+ /* This is the actual size of frac[] */
/*(frac[0] to frac[MaxPrec] are available). */
size_t Prec; /* Current precision size. */
- /* This indicates how much the. */
- /* the array frac[] is actually used. */
+ /* This indicates how much the */
+ /* array frac[] is actually used. */
SIGNED_VALUE exponent; /* Exponent part. */
short sign; /* Attributes of the value. */
/*