[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bignum branch

From: Andy Moreton
Subject: Re: bignum branch
Date: Mon, 06 Aug 2018 19:12:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt)

On Sun 05 Aug 2018, Eli Zaretskii wrote:

>> From: Andy Moreton <address@hidden>
>> Date: Sun, 05 Aug 2018 12:36:13 +0100
>> >> That allows "XBIGNUM(value)->value" to be replaced with "XBIGNUM(value)"
>> >> in all callers.
>> >
>> > That would go against the convention with all the other Xfoo macros.
>> True, the only thing with similar behaviour being xmint_pointer. While
>> inconsistent with the other Xfoo macros, it does reduce visual clutter
>> in the callers.
> Yes, but then how do you access the C structure represented by a Lisp
> bignum objects?  The usual way is XBIGNUM(bignum), from which you can
> access members other than 'value'.  If XBIGNUM expands into the value,
> we will need something else to do what XBIGNUM does now.
>> > However, I see your point, and so perhaps an additional macro,
>> > XINTEGER, could call either XINT or XBIGNUM()->value, depending on the
>> > argument type?
>> I'm not sure that would help, as callers still need to know if the
>> result is a bignum or fixnum to handle it correctly.
> That's fine, we have a lot of code like
>   if (NATNUMP (foo))
>     x = XFASTINT (foo);

ok, then maybe XINTEGER would still be useful.
On the bignum branch that code would now be:

    if (FIXNATP (foo))
      x = XFASTINT (foo);

Perhaps XFASTINT should be renamed XFIXNAT to be consistent.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]