autoconf-patches
[Top][All Lists]
Advanced

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

Re: proposed gnulib-related additions to Autoconf


From: Paul Eggert
Subject: Re: proposed gnulib-related additions to Autoconf
Date: Sat, 08 Apr 2006 11:28:21 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Ralf Wildenhues <address@hidden> writes:

> What I think you're trying to tell me is this: either the semantics are
> wrap-around or some notification (exception or so).  But LIA-1 does not
> specify bit-shift operations, as far as I can see.

Yes, that's true.  I'd forgotten about that.  To rely on LIA-1 we'd
have to switch to using multiplication rather than shifting.  And
given all the other, far more practical, problems that you report with
shifting, it seems pretty clear that we should use multiplication.

But I am starting to wonder whether it's worth it.

How about this idea instead.  We use CHAR_BIT * sizeof (type) to
estimate the number of value bits in the integer, just as intprops.h's
TYPE_MAXIMUM does.  We also test our guess, by making sure that we
can't compile a program claiming that (TYPE) MAX_VAL < (TYPE) (MAX_VAL
+ 1).  If our test fails, we report an error (e.g., by not defining
MAX_VAL).

An advantage of this approach is that it's much faster.  It fails on
weird machines with padding bits, but we can cross that bridge if we
ever come to it.




reply via email to

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