diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-07-08 12:11:56 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2022-07-08 12:11:56 +0900 |
commit | 9958ed61bc0f0156f5ed9fd8f058d964d84cac19 (patch) | |
tree | a731fddf702608d72a853a21e8057c8426919aed | |
parent | 4a2662ae8b9f64346af82551fdd6756e7497e2f1 (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6108
-rw-r--r-- | iseq.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -21,7 +21,7 @@ RUBY_EXTERN const int ruby_api_version[]; #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 |