Project

General

Profile

Feature #17752 » ruby-BIGNUM_EMBED_LEN_MAX.patch

Fix the definition of `BIGNUM_EMBED_LEN_MAX` - xtkoba (Tee KOBAYASHI), 04/07/2021 12:58 AM

View differences:

include/ruby/internal/core/rbasic.h
RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / (sizeof(T))))
/** @endcond */
enum ruby_rvalue_flags { RVALUE_EMBED_LEN_MAX = 3 };
#define _RVALUE_EMBED_LEN_MAX 3
enum ruby_rvalue_flags { RVALUE_EMBED_LEN_MAX = _RVALUE_EMBED_LEN_MAX };
struct
RUBY_ALIGNAS(SIZEOF_VALUE)
-- a/internal/bignum.h
++ b/internal/bignum.h
......
#define BIGNUM_EMBED_LEN_SHIFT \
(FL_USHIFT+3) /* bit offset of BIGNUM_EMBED_LEN_MASK */
#ifndef BIGNUM_EMBED_LEN_MAX
# if (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
# if (SIZEOF_VALUE*_RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
# define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT)
# else
# define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)
(2-2/5)