3 ms·
In Ruby C extensions it works like this: int FIXNUM_P(VALUE object_pointer) { return object_pointer & 1; } long FIX2LONG(VALUE object_pointer) { return obj
by matheusmoreira 7y ago
In Ruby C extensions it works like this:
int FIXNUM_P(VALUE object_pointer) { return object_pointer & 1; }
long FIX2LONG(VALUE object_pointer) { return object_pointer >> 1; }
VALUE ruby_value;
long number;
if (FIXNUM_P(ruby_value))
number = FIX2LONG(ruby_value);
I thought this was pretty simple. What does Python's C API look like?