summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-21 11:28:12 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-21 11:28:12 +0000
commitbbe805f09e48b5f2fd99b7cbadec69ccb73974e4 (patch)
tree8c5cfeeaf052b1d1acebc93243308bc4c0f18f83
parente9482963fd31122788746f130c87dc088509cd46 (diff)
downloadbundler-bbe805f09e48b5f2fd99b7cbadec69ccb73974e4.tar.gz
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
-rw-r--r--ChangeLog5
-rw-r--r--bignum.c1
-rw-r--r--internal.h3
3 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2c9dd6154d..5bea54690d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Jun 21 20:28:09 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h (roomof): extract from type_roomof, and move from
+ bignum.c.
+
Sun Jun 21 18:32:37 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ruby_atomic.h (ATOMIC_PTR_CAS): define by generic CAS macro, not
diff --git a/bignum.c b/bignum.c
index 17e8f701ff..a6d68d875b 100644
--- a/bignum.c
+++ b/bignum.c
@@ -98,7 +98,6 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGIT % SIZEOF_LONG == 0);
rb_absint_size(x, NULL))
#define BIGDIVREM_EXTRA_WORDS 1
-#define roomof(n, m) ((long)(((n)+(m)-1) / (m)))
#define bdigit_roomof(n) roomof(n, SIZEOF_BDIGIT)
#define BARY_ARGS(ary) ary, numberof(ary)
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))