mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Reduce the number of branch instructions in the heap_p()
As far as `gcc -S` for several CPU architectures has confirmed, it reduces the number of branch instructions by one.
This commit is contained in:
@@ -277,7 +277,7 @@ heap_p(mrb_gc *gc, const struct RBasic *object)
|
||||
RVALUE *p;
|
||||
|
||||
p = page->objects;
|
||||
if (&p[0].as.basic <= object && object <= &p[MRB_HEAP_PAGE_SIZE - 1].as.basic) {
|
||||
if ((uintptr_t)object - (uintptr_t)p <= (MRB_HEAP_PAGE_SIZE - 1) * sizeof(RVALUE)) {
|
||||
return TRUE;
|
||||
}
|
||||
page = page->next;
|
||||
|
||||
Reference in New Issue
Block a user