Re: [Bug-gnulib] addition: size_max.m4, ptrdiff_max.m4

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

 



Bruno Haible <bruno@xxxxxxxxx> writes:

> 'expr' is certainly the easiest auxiliary program that can be used to
> compute "2*x" and "(x+y)/2" for some integers x and y, but it's not the
> only one. You could also use 'sed' for this purpose.

Oh my goodness, I hadn't thought of that!  But I'd rather not program
extended-precision arithmetic by hand with 'sed'.  Instead, I was
thinking of fixing _AC_COMPUTE_INT to handle integers outside the
range LONG_MIN..LONG_MAX by having the shell use simple string
concatenation, and having the C compiler do the arithmetic instead.
If size_t is 32-bit 'unsigned long', for example, it suffices for
config.h to contain this:

#define SIZE_MAX (2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(1ul)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)+1)

and expressions like these can be computed easily using binary search.



[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux