8000 shape.h: make RSHAPE static inline · ruby/ruby@cc0e5fd · GitHub
[go: up one dir, main page]

Skip to content

Commit cc0e5fd

Browse files
committed
shape.h: make RSHAPE static inline
Since the shape_tree_ptr is `extern` it should be possible to fully inline `RSHAPE`.
1 parent 8b5ac5a commit cc0e5fd

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

shape.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,7 @@ rb_shape_each_shape_id(each_shape_callback callback, void *data)
383383
RUBY_FUNC_EXPORTED rb_shape_t *
384384
rb_shape_lookup(shape_id_t shape_id)
385385
{
386-
uint32_t offset = (shape_id & SHAPE_ID_OFFSET_MASK);
387-
RUBY_ASSERT(offset != INVALID_SHAPE_ID);
388-
389-
return &GET_SHAPE_TREE()->shape_list[offset];
386+
return RSHAPE(shape_id);
390387
}
391388

392389
RUBY_FUNC_EXPORTED shape_id_t

shape.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,14 @@ RBASIC_SET_SHAPE_ID(VALUE obj, shape_id_t shape_id)
149149
#endif
150150
}
151151

152-
#define RSHAPE rb_shape_lookup
152+
static inline rb_shape_t *
153+
RSHAPE(shape_id_t shape_id)
154+
{
155+
uint32_t offset = (shape_id & SHAPE_ID_OFFSET_MASK);
156+
RUBY_ASSERT(offset != INVALID_SHAPE_ID);
157+
158+
return &GET_SHAPE_TREE()->shape_list[offset];
159+
}
153160

154161
int32_t rb_shape_id_offset(void);
155162

0 commit comments

Comments
 (0)
0