Don't treat flonum specially in object ID

flonum is just a special constant, so we don't need to treat it in any
special way.
This commit is contained in:
Peter Zhu 2024-04-11 14:35:19 -04:00
parent edec690e03
commit 9bab179ca3

5
gc.c
View File

@ -4522,16 +4522,13 @@ os_id2ref(VALUE os, VALUE objid)
static VALUE static VALUE
rb_find_object_id(VALUE obj, VALUE (*get_heap_object_id)(VALUE)) rb_find_object_id(VALUE obj, VALUE (*get_heap_object_id)(VALUE))
{ {
if (FLONUM_P(obj)) { if (SPECIAL_CONST_P(obj)) {
#if SIZEOF_LONG == SIZEOF_VOIDP #if SIZEOF_LONG == SIZEOF_VOIDP
return LONG2NUM((SIGNED_VALUE)obj); return LONG2NUM((SIGNED_VALUE)obj);
#else #else
return LL2NUM((SIGNED_VALUE)obj); return LL2NUM((SIGNED_VALUE)obj);
#endif #endif
} }
else if (SPECIAL_CONST_P(obj)) {
return LONG2NUM((SIGNED_VALUE)obj);
}
return get_heap_object_id(obj); return get_heap_object_id(obj);
} }