Compile debugging code for integer pack always
This commit is contained in:
parent
d8d7591e6f
commit
7a0a218dff
2
.github/workflows/compilers.yml
vendored
2
.github/workflows/compilers.yml
vendored
@ -178,7 +178,7 @@ jobs:
|
|||||||
# - { name: USE_DEBUG_COUNTER, env: { cppflags: '-DUSE_DEBUG_COUNTER=1', RUBY_DEBUG_COUNTER_DISABLE: '1' } }
|
# - { name: USE_DEBUG_COUNTER, env: { cppflags: '-DUSE_DEBUG_COUNTER=1', RUBY_DEBUG_COUNTER_DISABLE: '1' } }
|
||||||
|
|
||||||
# - { name: DEBUG_FIND_TIME_NUMGUESS, env: { cppflags: '-DDEBUG_FIND_TIME_NUMGUESS' } }
|
# - { name: DEBUG_FIND_TIME_NUMGUESS, env: { cppflags: '-DDEBUG_FIND_TIME_NUMGUESS' } }
|
||||||
- { name: DEBUG_INTEGER_PACK, env: { cppflags: '-DDEBUG_INTEGER_PACK' } }
|
# - { name: DEBUG_INTEGER_PACK, env: { cppflags: '-DDEBUG_INTEGER_PACK' } }
|
||||||
# - { name: ENABLE_PATH_CHECK, env: { cppflags: '-DENABLE_PATH_CHECK' } }
|
# - { name: ENABLE_PATH_CHECK, env: { cppflags: '-DENABLE_PATH_CHECK' } }
|
||||||
|
|
||||||
- { name: GC_DEBUG_STRESS_TO_CLASS, env: { cppflags: '-DGC_DEBUG_STRESS_TO_CLASS' } }
|
- { name: GC_DEBUG_STRESS_TO_CLASS, env: { cppflags: '-DGC_DEBUG_STRESS_TO_CLASS' } }
|
||||||
|
16
bignum.c
16
bignum.c
@ -48,6 +48,14 @@
|
|||||||
#include "ruby/util.h"
|
#include "ruby/util.h"
|
||||||
#include "ruby_assert.h"
|
#include "ruby_assert.h"
|
||||||
|
|
||||||
|
static const bool debug_integer_pack = (
|
||||||
|
#ifdef DEBUG_INTEGER_PACK
|
||||||
|
DEBUG_INTEGER_PACK+0
|
||||||
|
#else
|
||||||
|
RUBY_DEBUG
|
||||||
|
#endif
|
||||||
|
) != 0;
|
||||||
|
|
||||||
const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
|
const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
|
||||||
|
|
||||||
#ifndef SIZEOF_BDIGIT_DBL
|
#ifndef SIZEOF_BDIGIT_DBL
|
||||||
@ -1049,15 +1057,13 @@ integer_unpack_num_bdigits(size_t numwords, size_t wordsize, size_t nails, int *
|
|||||||
|
|
||||||
if (numwords <= (SIZE_MAX - (BITSPERDIG-1)) / CHAR_BIT / wordsize) {
|
if (numwords <= (SIZE_MAX - (BITSPERDIG-1)) / CHAR_BIT / wordsize) {
|
||||||
num_bdigits = integer_unpack_num_bdigits_small(numwords, wordsize, nails, nlp_bits_ret);
|
num_bdigits = integer_unpack_num_bdigits_small(numwords, wordsize, nails, nlp_bits_ret);
|
||||||
#ifdef DEBUG_INTEGER_PACK
|
if (debug_integer_pack) {
|
||||||
{
|
|
||||||
int nlp_bits1;
|
int nlp_bits1;
|
||||||
size_t num_bdigits1 = integer_unpack_num_bdigits_generic(numwords, wordsize, nails, &nlp_bits1);
|
size_t num_bdigits1 = integer_unpack_num_bdigits_generic(numwords, wordsize, nails, &nlp_bits1);
|
||||||
assert(num_bdigits == num_bdigits1);
|
assert(num_bdigits == num_bdigits1);
|
||||||
assert(*nlp_bits_ret == nlp_bits1);
|
assert(*nlp_bits_ret == nlp_bits1);
|
||||||
(void)num_bdigits1;
|
(void)num_bdigits1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
num_bdigits = integer_unpack_num_bdigits_generic(numwords, wordsize, nails, nlp_bits_ret);
|
num_bdigits = integer_unpack_num_bdigits_generic(numwords, wordsize, nails, nlp_bits_ret);
|
||||||
@ -3423,15 +3429,13 @@ rb_absint_numwords(VALUE val, size_t word_numbits, size_t *nlz_bits_ret)
|
|||||||
|
|
||||||
if (numbytes <= SIZE_MAX / CHAR_BIT) {
|
if (numbytes <= SIZE_MAX / CHAR_BIT) {
|
||||||
numwords = absint_numwords_small(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits);
|
numwords = absint_numwords_small(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits);
|
||||||
#ifdef DEBUG_INTEGER_PACK
|
if (debug_integer_pack) {
|
||||||
{
|
|
||||||
size_t numwords0, nlz_bits0;
|
size_t numwords0, nlz_bits0;
|
||||||
numwords0 = absint_numwords_generic(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits0);
|
numwords0 = absint_numwords_generic(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits0);
|
||||||
assert(numwords0 == numwords);
|
assert(numwords0 == numwords);
|
||||||
assert(nlz_bits0 == nlz_bits);
|
assert(nlz_bits0 == nlz_bits);
|
||||||
(void)numwords0;
|
(void)numwords0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
numwords = absint_numwords_generic(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits);
|
numwords = absint_numwords_generic(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user