[前][次][番号順一覧][スレッド一覧]

ruby-changes:38905

From: nobu <ko1@a...>
Date: Sun, 21 Jun 2015 20:28:33 +0900 (JST)
Subject: [ruby-changes:38905] nobu:r50986 (trunk): internal.h: roomof

nobu	2015-06-21 20:28:12 +0900 (Sun, 21 Jun 2015)

  New Revision: 50986

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50986

  Log:
    internal.h: roomof
    
    * internal.h (roomof): extract from type_roomof, and move from
      bignum.c.

  Modified files:
    trunk/ChangeLog
    trunk/bignum.c
    trunk/internal.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50985)
+++ ChangeLog	(revision 50986)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Jun 21 20:28:09 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* internal.h (roomof): extract from type_roomof, and move from
+	  bignum.c.
+
 Sun Jun 21 18:32:37 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* ruby_atomic.h (ATOMIC_PTR_CAS): define by generic CAS macro, not
Index: internal.h
===================================================================
--- internal.h	(revision 50985)
+++ internal.h	(revision 50986)
@@ -611,7 +611,8 @@ struct MEMO { https://github.com/ruby/ruby/blob/trunk/internal.h#L611
 
 #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))
Index: bignum.c
===================================================================
--- bignum.c	(revision 50985)
+++ bignum.c	(revision 50986)
@@ -98,7 +98,6 @@ STATIC_ASSERT(sizeof_long_and_sizeof_bdi https://github.com/ruby/ruby/blob/trunk/bignum.c#L98
     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)
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]