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

ruby-changes:72467

From: Nobuyoshi <ko1@a...>
Date: Fri, 8 Jul 2022 17:27:37 +0900 (JST)
Subject: [ruby-changes:72467] 9958ed61bc (master): Use `roomof` macro

https://git.ruby-lang.org/ruby.git/commit/?id=9958ed61bc

From 9958ed61bc0f0156f5ed9fd8f058d964d84cac19 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 8 Jul 2022 12:11:56 +0900
Subject: Use `roomof` macro

The masking is not only unnecessary but works only when the masking
value is a power of 2.  Also suppress unary minus operator to unsigned
type warnings.
---
 iseq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/iseq.h b/iseq.h
index 1ca77a34d9..4c6d9f6597 100644
--- a/iseq.h
+++ b/iseq.h
@@ -21,7 +21,7 @@ RUBY_EXTERN const int ruby_api_version[]; https://github.com/ruby/ruby/blob/trunk/iseq.h#L21
 #define ISEQ_MBITS_BITLENGTH (ISEQ_MBITS_SIZE * CHAR_BIT)
 #define ISEQ_MBITS_SET(buf, i) (buf[(i) / ISEQ_MBITS_BITLENGTH] |= ((iseq_bits_t)1 << ((i) % ISEQ_MBITS_BITLENGTH)))
 #define ISEQ_MBITS_SET_P(buf, i) ((buf[(i) / ISEQ_MBITS_BITLENGTH] >> ((i) % ISEQ_MBITS_BITLENGTH)) & 0x1)
-#define ISEQ_MBITS_BUFLEN(size) (((size + (ISEQ_MBITS_BITLENGTH - 1)) & -ISEQ_MBITS_BITLENGTH) / ISEQ_MBITS_BITLENGTH)
+#define ISEQ_MBITS_BUFLEN(size) roomof(size, ISEQ_MBITS_BITLENGTH)
 
 #ifndef USE_ISEQ_NODE_ID
 #define USE_ISEQ_NODE_ID 1
-- 
cgit v1.2.1


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

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