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
40 40
    RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / (sizeof(T))))
41 41
/** @endcond */
42 42

  
43
enum ruby_rvalue_flags { RVALUE_EMBED_LEN_MAX = 3 };
43
#define _RVALUE_EMBED_LEN_MAX 3
44
enum ruby_rvalue_flags { RVALUE_EMBED_LEN_MAX = _RVALUE_EMBED_LEN_MAX };
44 45

  
45 46
struct
46 47
RUBY_ALIGNAS(SIZEOF_VALUE)
47
-- a/internal/bignum.h
48
++ b/internal/bignum.h
......
83 83
#define BIGNUM_EMBED_LEN_SHIFT \
84 84
    (FL_USHIFT+3) /* bit offset of BIGNUM_EMBED_LEN_MASK */
85 85
#ifndef BIGNUM_EMBED_LEN_MAX
86
# if (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
86
# if (SIZEOF_VALUE*_RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
87 87
#  define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*RVALUE_EMBED_LEN_MAX/SIZEOF_ACTUAL_BDIGIT)
88 88
# else
89 89
#  define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)