Skip to content

Commit 3c63489

Browse files
Remove the unnecesary integer comparison
Most compilers will optimise this anyway
1 parent d15117e commit 3c63489

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

gc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,9 +1282,7 @@ rb_gc_obj_needs_cleanup_p(VALUE obj)
12821282
uintptr_t type = (uintptr_t)RTYPEDDATA(obj)->type;
12831283
if (type & TYPED_DATA_EMBEDDED) {
12841284
RUBY_DATA_FUNC dfree = ((const rb_data_type_t *)(type & TYPED_DATA_PTR_MASK))->function.dfree;
1285-
// Fast path for embedded T_DATA with no custom free function.
1286-
// True when dfree is NULL (RUBY_NEVER_FREE) or -1 (RUBY_TYPED_DEFAULT_FREE).
1287-
if ((uintptr_t)dfree + 1 <= 1) return false;
1285+
return (dfree == RUBY_NEVER_FREE || dfree == RUBY_TYPED_DEFAULT_FREE);
12881286
}
12891287
}
12901288
return true;

0 commit comments

Comments
 (0)