bug-gnulib
[Top][All Lists]
Advanced

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

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


From: Paul Eggert
Subject: Re: [Bug-gnulib] addition: size_max.m4, ptrdiff_max.m4
Date: 13 Nov 2003 10:03:35 -0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Bruno Haible <address@hidden> 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.




reply via email to

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