use correct macros in ruby code so code compiles in 32bit and 64bit mode

This commit is contained in:
Edward Rudd 2014-01-01 11:20:42 -05:00
parent 1ce4970d62
commit 5c0295e972
2 changed files with 23 additions and 23 deletions

View File

@ -93,7 +93,7 @@ template<class C>
static inline C *
getPrivateDataCheck(VALUE self, const rb_data_type_struct &type)
{
void *obj = rb_check_typeddata(self, &type);
void *obj = Check_TypedStruct(self, &type);
return static_cast<C*>(obj);
}
@ -197,11 +197,11 @@ rb_float_arg(VALUE arg, double *out, int argPos = 0)
switch (rb_type(arg))
{
case RUBY_T_FLOAT :
*out = rb_float_value(arg);
*out = RFLOAT_VALUE(arg);
break;
case RUBY_T_FIXNUM :
*out = rb_fix2int(arg);
*out = FIX2INT(arg);
break;
default:
@ -216,11 +216,11 @@ rb_int_arg(VALUE arg, int *out, int argPos = 0)
{
case RUBY_T_FLOAT :
// FIXME check int range?
*out = rb_num2long(arg);
*out = NUM2LONG(arg);
break;
case RUBY_T_FIXNUM :
*out = rb_fix2int(arg);
*out = FIX2INT(arg);
break;
default:

View File

@ -47,18 +47,18 @@ RB_METHOD(tableResize)
{
default:
case 1:
t->resize(rb_fix2int(argv[0]));
t->resize(FIX2INT(argv[0]));
return Qnil;
case 2:
t->resize(rb_fix2int(argv[0]),
rb_fix2int(argv[1]));
t->resize(FIX2INT(argv[0]),
FIX2INT(argv[1]));
return Qnil;
case 3:
t->resize(rb_fix2int(argv[0]),
rb_fix2int(argv[1]),
rb_fix2int(argv[2]));
t->resize(FIX2INT(argv[0]),
FIX2INT(argv[1]),
FIX2INT(argv[2]));
return Qnil;
}
}
@ -82,11 +82,11 @@ RB_METHOD(tableGetAt)
int x, y, z;
x = y = z = 0;
x = rb_num2int(argv[0]);
x = NUM2INT(argv[0]);
if (argc > 1)
y = rb_num2int(argv[1]);
y = NUM2INT(argv[1]);
if (argc > 2)
z = rb_num2int(argv[2]);
z = NUM2INT(argv[2]);
if (argc > 3)
rb_raise(rb_eArgError, "wrong number of arguments");
@ -117,19 +117,19 @@ RB_METHOD(tableSetAt)
{
default:
case 2 :
x = rb_fix2int(argv[0]);
value = rb_fix2int(argv[1]);
x = FIX2INT(argv[0]);
value = FIX2INT(argv[1]);
break;
case 3 :
x = rb_fix2int(argv[0]);
y = rb_fix2int(argv[1]);
value = rb_fix2int(argv[2]);
x = FIX2INT(argv[0]);
y = FIX2INT(argv[1]);
value = FIX2INT(argv[2]);
break;
case 4 :
x = rb_fix2int(argv[0]);
y = rb_fix2int(argv[1]);
z = rb_fix2int(argv[2]);
value = rb_fix2int(argv[3]);
x = FIX2INT(argv[0]);
y = FIX2INT(argv[1]);
z = FIX2INT(argv[2]);
value = FIX2INT(argv[3]);
break;
}