* ext/bigdecimal/bigdecimal.c (is_kind_of_BigDecimal): new function to
examine the whether the object is kind of BigDecimal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3bd8b390de
commit
5112c6d1d9
@ -1,3 +1,8 @@
|
|||||||
|
Mon Jun 13 18:52:00 2011 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
|
* ext/bigdecimal/bigdecimal.c (is_kind_of_BigDecimal): new function to
|
||||||
|
examine the whether the object is kind of BigDecimal.
|
||||||
|
|
||||||
Mon Jun 13 18:49:00 2011 Kenta Murata <mrkn@mrkn.jp>
|
Mon Jun 13 18:49:00 2011 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
* ext/bigdecimal/bigdecimal.c (BigDecimalCmp): use GetVpValueWithPrec
|
* ext/bigdecimal/bigdecimal.c (BigDecimalCmp): use GetVpValueWithPrec
|
||||||
|
@ -119,6 +119,12 @@ static const rb_data_type_t BigDecimal_data_type = {
|
|||||||
{0, BigDecimal_delete, BigDecimal_memsize,},
|
{0, BigDecimal_delete, BigDecimal_memsize,},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
is_kind_of_BigDecimal(VALUE const v)
|
||||||
|
{
|
||||||
|
return rb_typeddata_is_kind_of(v, &BigDecimal_data_type);
|
||||||
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
ToValue(Real *p)
|
ToValue(Real *p)
|
||||||
{
|
{
|
||||||
@ -168,7 +174,7 @@ again:
|
|||||||
goto SomeOneMayDoIt;
|
goto SomeOneMayDoIt;
|
||||||
|
|
||||||
case T_DATA:
|
case T_DATA:
|
||||||
if (rb_typeddata_is_kind_of(v, &BigDecimal_data_type)) {
|
if (is_kind_of_BigDecimal(v)) {
|
||||||
pv = DATA_PTR(v);
|
pv = DATA_PTR(v);
|
||||||
return pv;
|
return pv;
|
||||||
}
|
}
|
||||||
@ -798,7 +804,7 @@ BigDecimalCmp(VALUE self, VALUE r,char op)
|
|||||||
GUARD_OBJ(a,GetVpValue(self,1));
|
GUARD_OBJ(a,GetVpValue(self,1));
|
||||||
switch (TYPE(r)) {
|
switch (TYPE(r)) {
|
||||||
case T_DATA:
|
case T_DATA:
|
||||||
if (!rb_typeddata_is_kind_of(r, &BigDecimal_data_type)) break;
|
if (!is_kind_of_BigDecimal(r)) break;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case T_FIXNUM:
|
case T_FIXNUM:
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user