[Ecls-list] Adding long long support to FFI.

Greg Pfeil sellout42 at mac.com
Thu May 4 12:59:01 UTC 2006


On 3 May 2006, at 0:06, Goffioul Michael wrote:

> (Not sure about the following, because I'm using ECL under Windows)
> Isn't there a rounding problem when calling make_integer with a
> long long argument? This function is defined on cl_fixnum, but to
> which type cl_fixnum is typedef'ed on your system?

I probably just don't understand ECL well enough yet, but isn't it odd 
that this is defined to take cl_fixnum, but yet checks for fixnum 
bounds and creates a bignum if the number falls outside them?

Also, would it be bad to define this on long long if it is available?

cl_object
make_integer(cl_fixnum l)
{
	if (l > MOST_POSITIVE_FIXNUM || l < MOST_NEGATIVE_FIXNUM) {
		cl_object z = cl_alloc_object(t_bignum);
#ifdef WITH_GMP
		mpz_init_set_si(z->big.big_num, l);
#else  /* WITH_GMP */
                 z->big.big_num = l;
#endif /* WITH_GMP */
		return z;
	}
	return MAKE_FIXNUM(l);
}





More information about the ecl-devel mailing list