Skip to content

Commit

Permalink
Removed non-RUBY_INTEGER_UNIFICATION code
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Mar 21, 2020
1 parent 6f04467 commit 5b28748
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 45 deletions.
2 changes: 1 addition & 1 deletion array.c
Expand Up @@ -2760,7 +2760,7 @@ sort_2(const void *ap, const void *bp, void *dummy)
VALUE a = *(const VALUE *)ap, b = *(const VALUE *)bp;
int n;

if (FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data->cmp_opt, Fixnum)) {
if (FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data->cmp_opt, Integer)) {
if ((long)a > (long)b) return 1;
if ((long)a < (long)b) return -1;
return 0;
Expand Down
6 changes: 0 additions & 6 deletions bignum.c
Expand Up @@ -45,9 +45,6 @@

#define RB_BIGNUM_TYPE_P(x) RB_TYPE_P((x), T_BIGNUM)

#ifndef RUBY_INTEGER_UNIFICATION
VALUE rb_cBignum;
#endif
const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";

#ifndef SIZEOF_BDIGIT_DBL
Expand Down Expand Up @@ -7190,9 +7187,6 @@ rb_int_powm(int const argc, VALUE * const argv, VALUE const num)
void
Init_Bignum(void)
{
#ifndef RUBY_INTEGER_UNIFICATION
rb_cBignum = rb_cInteger;
#endif
/* An obsolete class, use Integer */
rb_define_const(rb_cObject, "Bignum", rb_cInteger);
rb_deprecate_constant(rb_cObject, "Bignum");
Expand Down
6 changes: 0 additions & 6 deletions include/ruby/ruby.h
Expand Up @@ -1956,9 +1956,6 @@ RUBY_EXTERN VALUE rb_mWaitWritable;
RUBY_EXTERN VALUE rb_cBasicObject;
RUBY_EXTERN VALUE rb_cObject;
RUBY_EXTERN VALUE rb_cArray;
#ifndef RUBY_INTEGER_UNIFICATION
RUBY_EXTERN VALUE rb_cBignum;
#endif
RUBY_EXTERN VALUE rb_cBinding;
RUBY_EXTERN VALUE rb_cClass;
RUBY_EXTERN VALUE rb_cCont;
Expand All @@ -1968,9 +1965,6 @@ RUBY_EXTERN VALUE rb_cEncoding;
RUBY_EXTERN VALUE rb_cEnumerator;
RUBY_EXTERN VALUE rb_cFalseClass;
RUBY_EXTERN VALUE rb_cFile;
#ifndef RUBY_INTEGER_UNIFICATION
RUBY_EXTERN VALUE rb_cFixnum;
#endif
RUBY_EXTERN VALUE rb_cComplex;
RUBY_EXTERN VALUE rb_cFloat;
RUBY_EXTERN VALUE rb_cHash;
Expand Down
10 changes: 2 additions & 8 deletions internal/compar.h
Expand Up @@ -9,18 +9,12 @@
* modify this file, provided that the conditions mentioned in the
* file COPYING are met. Consult the file for details.
*/
#include "ruby/ruby.h" /* for RUBY_INTEGER_UNIFICATION */
#include "internal/vm.h" /* for rb_method_basic_definition_p */

#define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString)

#ifdef RUBY_INTEGER_UNIFICATION
# define rb_cFixnum rb_cInteger
# define rb_cBignum rb_cInteger
#endif

enum {
cmp_opt_Fixnum,
cmp_opt_Integer,
cmp_opt_String,
cmp_opt_Float,
cmp_optimizable_count
Expand All @@ -42,7 +36,7 @@ struct cmp_opt_data {
((data).opt_methods |= CMP_OPTIMIZABLE_BIT(type))))

#define OPTIMIZED_CMP(a, b, data) \
((FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data, Fixnum)) ? \
((FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data, Integer)) ? \
(((long)a > (long)b) ? 1 : ((long)a < (long)b) ? -1 : 0) : \
(STRING_P(a) && STRING_P(b) && CMP_OPTIMIZABLE(data, String)) ? \
rb_str_cmp(a, b) : \
Expand Down
6 changes: 0 additions & 6 deletions numeric.c
Expand Up @@ -192,9 +192,6 @@ static ID id_coerce;
VALUE rb_cNumeric;
VALUE rb_cFloat;
VALUE rb_cInteger;
#ifndef RUBY_INTEGER_UNIFICATION
VALUE rb_cFixnum;
#endif

VALUE rb_eZeroDivError;
VALUE rb_eFloatDomainError;
Expand Down Expand Up @@ -5687,9 +5684,6 @@ Init_Numeric(void)
rb_define_method(rb_cInteger, "bit_length", rb_int_bit_length, 0);
rb_define_method(rb_cInteger, "digits", rb_int_digits, -1);

#ifndef RUBY_INTEGER_UNIFICATION
rb_cFixnum = rb_cInteger;
#endif
/* An obsolete class, use Integer */
rb_define_const(rb_cObject, "Fixnum", rb_cInteger);
rb_deprecate_constant(rb_cObject, "Fixnum");
Expand Down
18 changes: 0 additions & 18 deletions spec/ruby/optional/capi/ext/constants_spec.c
Expand Up @@ -9,12 +9,6 @@ static VALUE constants_spec_rb_cArray(VALUE self) {
return rb_cArray;
}

#ifndef RUBY_INTEGER_UNIFICATION
static VALUE constants_spec_rb_cBignum(VALUE self) {
return rb_cBignum;
}
#endif

static VALUE constants_spec_rb_cClass(VALUE self) {
return rb_cClass;
}
Expand All @@ -31,12 +25,6 @@ static VALUE constants_spec_rb_cFile(VALUE self) {
return rb_cFile;
}

#ifndef RUBY_INTEGER_UNIFICATION
static VALUE constants_spec_rb_cFixnum(VALUE self) {
return rb_cFixnum;
}
#endif

static VALUE constants_spec_rb_cFloat(VALUE self) {
return rb_cFloat;
}
Expand Down Expand Up @@ -264,17 +252,11 @@ static VALUE constants_spec_rb_cDir(VALUE self) {
void Init_constants_spec(void) {
VALUE cls = rb_define_class("CApiConstantsSpecs", rb_cObject);
rb_define_method(cls, "rb_cArray", constants_spec_rb_cArray, 0);
#ifndef RUBY_INTEGER_UNIFICATION
rb_define_method(cls, "rb_cBignum", constants_spec_rb_cBignum, 0);
#endif

rb_define_method(cls, "rb_cClass", constants_spec_rb_cClass, 0);
rb_define_method(cls, "rb_cData", constants_spec_rb_cData, 0);
rb_define_method(cls, "rb_cFalseClass", constants_spec_rb_cFalseClass, 0);
rb_define_method(cls, "rb_cFile", constants_spec_rb_cFile, 0);
#ifndef RUBY_INTEGER_UNIFICATION
rb_define_method(cls, "rb_cFixnum", constants_spec_rb_cFixnum, 0);
#endif

rb_define_method(cls, "rb_cFloat", constants_spec_rb_cFloat, 0);
rb_define_method(cls, "rb_cHash", constants_spec_rb_cHash, 0);
Expand Down

0 comments on commit 5b28748

Please sign in to comment.