Method: Mustang::V8::Integer#to_i

Defined in:
ext/v8/v8_integer.cpp

#to_iObject

Returns fixnum value representation of referenced v8 integer.



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'ext/v8/v8_integer.cpp', line 43

static VALUE rb_v8_integer_to_i(VALUE self)
{
  HandleScope scope;
  Local<Integer> num = unwrap(self);

  if (num->IsUint32()) {
    return UINT2NUM(num->Uint32Value());
  } else if (num->IsInt32()) {
    return INT2NUM(num->Int32Value());
  } else {
    return INT2NUM(0);
  }
}