From bbe805f09e48b5f2fd99b7cbadec69ccb73974e4 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 21 Jun 2015 11:28:12 +0000 Subject: internal.h: roomof * internal.h (roomof): extract from type_roomof, and move from bignum.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- internal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'internal.h') diff --git a/internal.h b/internal.h index 5fb1493be6..84eb6e204e 100644 --- a/internal.h +++ b/internal.h @@ -611,7 +611,8 @@ struct MEMO { #define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0)) -#define type_roomof(x, y) ((sizeof(x) + sizeof(y) - 1) / sizeof(y)) +#define roomof(x, y) (((x) + (y) - 1) / (y)) +#define type_roomof(x, y) roomof(sizeof(x), sizeof(y)) #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value)) #define NEW_MEMO_FOR(type, value) \ ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value)) -- cgit v1.2.3