#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;
#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;
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) \
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);
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
{
#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)
{
{
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)
{
}
#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
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)) {
}
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)) {
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))
}
* SBCL's newest algorithm. Leads to few collisions, and it is faster.
*/
-#if FIXNUM_BITS > 32
+#if ECL_FIXNUM_BITS > 32
/*
* 64 bit version
*/
* 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;
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;
}
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);
{
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] =
}
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
x);
}
-#if FIXNUM_BITS < 32
+#if ECL_FIXNUM_BITS < 32
# error "Unsupported platform with cl_fixnum < ecl_uint32_t"
#endif
}
#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;
}
#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)) {
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;
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;
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) {
* 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;
{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},
*/
#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
*/
#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@
((void) memcpy(&(dst), &(src), sizeof(va_list)))
#endif
-#ifndef FIXNUM_BITS
+#ifndef ECL_FIXNUM_BITS
#include <ecl/config.h>
#endif
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);
#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
# 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