FIXNUM_BITS -> ECL_FIXNUM_BITS consistently, second try
authorMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 30 Aug 2015 20:35:14 +0000 (16:35 -0400)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Sun, 30 Aug 2015 20:35:14 +0000 (16:35 -0400)
14 files changed:
msvc/ecl/config.h.msvc6
src/c/big.d
src/c/file.d
src/c/hash.d
src/c/newhash.h
src/c/num_log.d
src/c/num_rand.d
src/c/number.d
src/c/pathname.d
src/c/symbols_list.h
src/h/bytecodes.h
src/h/config.h.in
src/h/ecl.h
src/h/external.h

index a91691c..28b7747 100755 (executable)
 #ifdef _M_X64
 #define ECL_INT_BITS           64
 #define ECL_LONG_BITS          32
-#define FIXNUM_BITS            64
+#define ECL_FIXNUM_BITS                64
 #define MOST_POSITIVE_FIXNUM   ((cl_fixnum)2305843009213693951LL)
 #define MOST_NEGATIVE_FIXNUM   ((cl_fixnum)-2305843009213693952LL)
 typedef long long cl_fixnum;
@@ -151,7 +151,7 @@ typedef unsigned long long cl_hashkey;
 #else
 #define ECL_INT_BITS           32
 #define ECL_LONG_BITS          32
-#define FIXNUM_BITS            32
+#define ECL_FIXNUM_BITS                32
 #define MOST_POSITIVE_FIXNUM   ((cl_fixnum)536870911)
 #define MOST_NEGATIVE_FIXNUM   ((cl_fixnum)-536870912)
 typedef int cl_fixnum;
index 1ed72e0..15d2687 100644 (file)
@@ -105,10 +105,11 @@ _ecl_big_register_normalize(cl_object x)
         return _ecl_big_register_copy(x);
 }
 
-#if GMP_LIMB_BITS >= FIXNUM_BITS
+#if GMP_LIMB_BITS >= ECL_FIXNUM_BITS
 static const int limbs_per_fixnum = 1;
 #else
-static const int limbs_per_fixnum = (FIXNUM_BITS + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
+static const int limbs_per_fixnum = (ECL_FIXNUM_BITS + GMP_LIMB_BITS - 1) /
+        GMP_LIMB_BITS;
 #endif
 
 #define ECL_BIGNUM_ABS_SIZE(x) \
@@ -117,7 +118,7 @@ static const int limbs_per_fixnum = (FIXNUM_BITS + GMP_LIMB_BITS - 1) / GMP_LIMB
 cl_object
 _ecl_fix_times_fix(cl_fixnum x, cl_fixnum y)
 {
-#if ECL_LONG_BITS >= FIXNUM_BITS
+#if ECL_LONG_BITS >= ECL_FIXNUM_BITS
         ECL_WITH_TEMP_BIGNUM(z,4);
         _ecl_big_set_si(z, x);
         _ecl_big_mul_si(z, z, y);
@@ -160,7 +161,7 @@ _ecl_big_times_fix(cl_object b, cl_fixnum i)
         size = ECL_BIGNUM_ABS_SIZE(b);
         size += limbs_per_fixnum;
         z = _ecl_alloc_compact_bignum(size);
-#if ECL_LONG_BITS >= FIXNUM_BITS
+#if ECL_LONG_BITS >= ECL_FIXNUM_BITS
         _ecl_big_mul_si(z, b, i);
 #else
         {
@@ -332,7 +333,7 @@ fixnnint(cl_object x)
 
 #undef _ecl_big_set_fixnum
 #undef _ecl_big_set_index
-#if ECL_LONG_BITS >= FIXNUM_BITS
+#if ECL_LONG_BITS >= ECL_FIXNUM_BITS
 cl_object
 _ecl_big_set_fixnum(cl_object x, cl_fixnum f)
 {
@@ -358,7 +359,7 @@ _ecl_big_get_index(cl_object x)
 {
         return mpz_get_ui((x)->big.big_num);
 }
-#elif GMP_LIMB_BITS >= FIXNUM_BITS
+#elif GMP_LIMB_BITS >= ECL_FIXNUM_BITS
 cl_object
 _ecl_big_set_fixnum(cl_object x, cl_fixnum f)
 {
@@ -408,7 +409,7 @@ _ecl_big_fits_in_index(cl_object x)
 }
 #else
 # error "ECL cannot build with GMP when both long and mp_limb_t are smaller than cl_fixnum"
-#endif /* FIXNUM_BITS > GMP_LIMB_BITS, ECL_LONG_BITS */
+#endif /* ECL_FIXNUM_BITS > GMP_LIMB_BITS, ECL_LONG_BITS */
 
 #ifdef ECL_LONG_FLOAT
 long double
index 2dbfd86..52f288b 100755 (executable)
@@ -5344,7 +5344,7 @@ ecl_off_t_to_integer(ecl_off_t offset)
                 cl_object y = _ecl_big_register0();
                 if (sizeof(ECL_BIGNUM_LIMBS(y)[0]) == sizeof(cl_index)) {
                         ECL_BIGNUM_LIMBS(y)[0] = (cl_index)offset;
-                        offset >>= FIXNUM_BITS;
+                        offset >>= ECL_FIXNUM_BITS;
                         ECL_BIGNUM_LIMBS(y)[1] = offset;
                         ECL_BIGNUM_SIZE(y) = offset? 2 : 1;
                 } else if (sizeof(ECL_BIGNUM_LIMBS(y)[0]) >= sizeof(ecl_off_t)) {
@@ -5371,7 +5371,7 @@ ecl_integer_to_off_t(cl_object offset)
                         }
                         if (ECL_BIGNUM_SIZE(offset) == 2) {
                             output = ECL_BIGNUM_LIMBS(offset)[1];
-                            output <<= FIXNUM_BITS;
+                            output <<= ECL_FIXNUM_BITS;
                         }
                         output += ECL_BIGNUM_LIMBS(offset)[0];
                 } else if (sizeof(ECL_BIGNUM_LIMBS(offset)[0]) >= sizeof(ecl_off_t)) {
index 7d9069b..e411def 100644 (file)
@@ -1055,7 +1055,7 @@ cl_object
 cl_sxhash(cl_object key)
 {
         cl_index output = _hash_equal(3, 0, key);
-        const cl_index mask = ((cl_index)1 << (FIXNUM_BITS - 3)) - 1;
+        const cl_index mask = ((cl_index)1 << (ECL_FIXNUM_BITS - 3)) - 1;
         @(return ecl_make_fixnum(output & mask))
 }
 
index 461cfe4..cede456 100644 (file)
@@ -7,7 +7,7 @@
  * SBCL's newest algorithm. Leads to few collisions, and it is faster.
  */
 
-#if FIXNUM_BITS > 32
+#if ECL_FIXNUM_BITS > 32
 /*
  * 64 bit version
  */
index 957c415..3ce4aa3 100644 (file)
@@ -258,7 +258,7 @@ ecl_ash(cl_object x, cl_fixnum w)
                          * to implementation-specific results :-/
                          */
                         cl_fixnum y = ecl_fixnum(x);
-                        if (bits >= FIXNUM_BITS) {
+                        if (bits >= ECL_FIXNUM_BITS) {
                                 y = (y < 0)? -1 : 0;
                         } else {
                                 y >>= bits;
@@ -282,7 +282,7 @@ ecl_fixnum_bit_length(cl_fixnum i)
         int count;
         if (i < 0)
                 i = ~i;
-        for (count = 0; i && (count < FIXNUM_BITS); i >>= 1, count++)
+        for (count = 0; i && (count < ECL_FIXNUM_BITS); i >>= 1, count++)
                 ;
         return count;
 }
@@ -382,7 +382,7 @@ cl_logbitp(cl_object p, cl_object x)
                 cl_index n = ecl_to_size(p);
                 if (ECL_FIXNUMP(x)) {
                         cl_fixnum y = ecl_fixnum(x);
-                        if (n >= FIXNUM_BITS) {
+                        if (n >= ECL_FIXNUM_BITS) {
                                 i = (y < 0);
                         } else {
                                 i = ((y >> n) & 1);
index 89eb2bb..89f2d01 100644 (file)
@@ -168,8 +168,8 @@ random_integer(cl_object limit, cl_object state)
 {
         cl_index bit_length = ecl_integer_length(limit);
         cl_object buffer;
-        if (bit_length <= FIXNUM_BITS)
-                bit_length = FIXNUM_BITS;
+        if (bit_length <= ECL_FIXNUM_BITS)
+                bit_length = ECL_FIXNUM_BITS;
         buffer = ecl_ash(ecl_make_fixnum(1), bit_length);
         for (bit_length = mpz_size(buffer->big.big_num); bit_length; ) {
                 ECL_BIGNUM_LIMBS(buffer)[--bit_length] =
@@ -187,7 +187,7 @@ rando(cl_object x, cl_object rs)
         }
         switch (ecl_t_of(x)) {
         case t_fixnum:
-#if FIXNUM_BITS <= 32
+#if ECL_FIXNUM_BITS <= 32
                 z = ecl_make_fixnum(generate_int32(rs->random.value) % ecl_fixnum(x));
                 break;
 #endif
index c55da4d..52100a7 100644 (file)
@@ -147,7 +147,7 @@ ecl_to_short(cl_object x) {
                               x);
 }
 
-#if FIXNUM_BITS < 32
+#if ECL_FIXNUM_BITS < 32
 # error "Unsupported platform with cl_fixnum < ecl_uint32_t"
 #endif
 
@@ -184,7 +184,7 @@ ecl_to_int16_t(cl_object x) {
 }
 #endif /* ecl_uint16_t */
 
-#if defined(ecl_uint32_t) && (FIXNUM_BITS > 32)
+#if defined(ecl_uint32_t) && (ECL_FIXNUM_BITS > 32)
 ecl_uint32_t
 ecl_to_uint32_t(cl_object x) {
         const uint32_t uint32_max = 0xFFFFFFFFUL;
@@ -216,7 +216,7 @@ ecl_to_int32_t(cl_object x) {
 }
 #endif /* ecl_uint32_t */
 
-#if defined(ecl_uint64_t) && (FIXNUM_BITS < 64)
+#if defined(ecl_uint64_t) && (ECL_FIXNUM_BITS < 64)
 ecl_uint64_t
 ecl_to_uint64_t(cl_object x) {
         if (!ecl_minusp(x)) {
@@ -343,13 +343,14 @@ ecl_to_ulong_long(cl_object x) {
                         return (ecl_ulong_long_t)mpz_get_ui(x->big.big_num);
                 } else {
                         cl_object copy = _ecl_big_register0();
-                        int i = ECL_LONG_LONG_BITS - FIXNUM_BITS;
+                        int i = ECL_LONG_LONG_BITS - ECL_FIXNUM_BITS;
                         mpz_fdiv_q_2exp(copy->bit.big_num, x->big.big_num, i);
                         if (mpz_fits_ulong_p(copy->big.big_num)) {
                                 volatile ecl_ulong_long_t output;
                                 output = mpz_get_ui(copy->big.big_num);
-                                for (i -= FIXNUM_BITS; i; i-= FIXNUM_BITS) {
-                                        output = (output << FIXNUM_BITS);
+                                for (i -= ECL_FIXNUM_BITS; i;
+                                     i-= ECL_FIXNUM_BITS) {
+                                        output = (output << ECL_FIXNUM_BITS);
                                         output += mpz_get_ui(x->big.big_num);
                                 }
                                 return output;
@@ -373,13 +374,13 @@ ecl_to_long_long(cl_object x)
                 return (ecl_long_long_t)mpz_get_si(x->big.big_num);
         } else {
                 cl_object copy = _ecl_big_register0();
-                int i = ECL_LONG_LONG_BITS - FIXNUM_BITS;
+                int i = ECL_LONG_LONG_BITS - ECL_FIXNUM_BITS;
                 mpz_fdiv_q_2exp(copy->bit.big_num, x->big.big_num, i);
                 if (mpz_fits_ulong_p(copy->big.big_num)) {
                         volatile ecl_long_long_t output;
                         output = mpz_get_si(copy->big.big_num);
-                        for (i -= FIXNUM_BITS; i; i-= FIXNUM_BITS) {
-                                output = (output << FIXNUM_BITS);
+                        for (i -= ECL_FIXNUM_BITS; i; i-= ECL_FIXNUM_BITS) {
+                                output = (output << ECL_FIXNUM_BITS);
                                 output += mpz_get_ui(x->big.big_num);
                         }
                         return output;
@@ -876,7 +877,7 @@ cl_rational(cl_object x)
 cl_object
 _ecl_long_double_to_integer(long double d0)
 {
-        const int fb = FIXNUM_BITS - 3;
+        const int fb = ECL_FIXNUM_BITS - 3;
         int e;
         long double d = frexpl(d0, &e);
         if (e <= fb) {
index 109f016..1961df7 100644 (file)
@@ -1105,7 +1105,7 @@ NO_DIRECTORY:
                                  * we cannot use cl_write and friends.
                                  */
                                 int n = ecl_fixnum(y), i;
-                                char b[FIXNUM_BITS/2];
+                                char b[ECL_FIXNUM_BITS / 2];
                                 for (i = 0; n; i++) {
                                         b[i] = n%10 + '0';
                                         n = n/10;
index 94425ad..5cba898 100755 (executable)
@@ -1729,7 +1729,7 @@ cl_symbols[] = {
 {CLOS_ "DOCSTRING", CLOS_ORDINARY, NULL, -1, OBJNULL},
 {CLOS_ "SAFE-INSTANCE-REF", CLOS_ORDINARY, clos_safe_instance_ref, 2, OBJNULL},
 
-{SYS_ "CL-FIXNUM-BITS", SI_CONSTANT, NULL, -1, ecl_make_fixnum(FIXNUM_BITS)},
+{SYS_ "CL-FIXNUM-BITS", SI_CONSTANT, NULL, -1, ecl_make_fixnum(ECL_FIXNUM_BITS)},
 {EXT_ "CL-FIXNUM", EXT_ORDINARY, NULL, -1, NULL},
 {EXT_ "CL-INDEX", EXT_ORDINARY, NULL, -1, NULL},
 
index 9bb4c13..b59366d 100644 (file)
@@ -153,7 +153,7 @@ typedef int16_t cl_oparg;
  */
 #if (defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(__clang__) && !defined(__llvm__))
 #define ECL_THREADED_INTERPRETER
-# if defined(__sun__) && (FIXNUM_BITS > 32)
+# if defined(__sun__) && (ECL_FIXNUM_BITS > 32)
 #  undef ECL_THREADED_INTERPRETER
 # endif
 #endif
index 09903e2..5bd2847 100644 (file)
  */
 #define ECL_INT_BITS            @CL_INT_BITS@
 #define ECL_LONG_BITS           @CL_LONG_BITS@
-#define FIXNUM_BITS             @CL_FIXNUM_BITS@
+#define ECL_FIXNUM_BITS         @CL_FIXNUM_BITS@
 #define MOST_POSITIVE_FIXNUM    ((cl_fixnum)@CL_FIXNUM_MAX@)
 #define MOST_NEGATIVE_FIXNUM    ((cl_fixnum)@CL_FIXNUM_MIN@)
 #define MOST_POSITIVE_FIXNUM_VAL @CL_FIXNUM_MAX@
index 4fc320f..d9b3cd4 100644 (file)
@@ -31,7 +31,7 @@
    ((void) memcpy(&(dst), &(src), sizeof(va_list)))
 #endif
 
-#ifndef FIXNUM_BITS
+#ifndef ECL_FIXNUM_BITS
 #include <ecl/config.h>
 #endif
 
index 20bf469..9a4bf32 100755 (executable)
@@ -1030,8 +1030,8 @@ extern ECL_API ecl_uint8_t ecl_to_uint8_t(cl_object o);
 extern ECL_API ecl_int8_t ecl_to_int8_t(cl_object o);
 #define ecl_make_uint8_t(i) ecl_make_fixnum(i)
 #define ecl_make_int8_t(i) ecl_make_fixnum(i)
-#if FIXNUM_BITS < 32
-# error "Unsupported platforms with FIXNUM_BITS < 32"
+#if ECL_FIXNUM_BITS < 32
+# error "Unsupported platforms with ECL_FIXNUM_BITS < 32"
 #endif
 #ifdef ecl_uint16_t
 extern ECL_API ecl_uint16_t ecl_to_uint16_t(cl_object o);
@@ -1044,7 +1044,7 @@ extern ECL_API short ecl_to_short(cl_object o);
 #define ecl_make_short(n) ecl_make_fixnum(n)
 #define ecl_make_ushort(n) ecl_make_fixnum(n)
 #ifdef ecl_uint32_t
-# if FIXNUM_BITS == 32
+# if ECL_FIXNUM_BITS == 32
 #  define ecl_to_uint32_t fixnnint
 #  define ecl_to_int32_t fixint
 #  define ecl_make_uint32_t ecl_make_unsigned_integer
@@ -1057,7 +1057,7 @@ extern ECL_API ecl_int32_t ecl_to_int32_t(cl_object o);
 # endif
 #endif /* ecl_uint32_t */
 #ifdef ecl_uint64_t
-# if FIXNUM_BITS >= 64
+# if ECL_FIXNUM_BITS >= 64
 #  define ecl_to_uint64_t fixnnint
 #  define ecl_to_int64_t fixint
 #  define ecl_make_uint64_t ecl_make_unsigned_integer