Re: Optimize three-valued comparison between integers

2020-07-24 Thread Bruno Haible
Florian Weimer wrote: > On s390x, all three variants use conditional > branches, but the first one is the shortest. On s390x in 64-bit mode (at least with gcc-4.9), and for argument types that are smaller than 64 bits, it is possible to avoid the conditional branches by coding a 63-bit shift: int

Re: Optimize three-valued comparison between integers

2020-07-24 Thread Bruno Haible
Florian Weimer wrote: > On s390x, all three variants use conditional > branches, but the first one is the shortest. Indeed. Surprising. > There is also this: > > int sign4 (long n1, long n2) > { > return (char) ((n1 > n2) - (n1 < n2)); > } The case should be towards (signed char). Otherwise,

doc: update for more recent versions of Cygwin and Mac OS X

2020-07-24 Thread Bruno Haible
The Gnulib documentation regarding Cygwin and Mac OS X is out-of-date: Cygwin 1.7.x and Mac OS X 10.5 are hardly in use any more. With these patches, I'm updating it to Cygwin 2.9.0 and Mac OS X 10.13. Still not the newest (they are from 2017), but better than before. 2020-07-24 Bruno Haible

[PATCH] parse-datetime: modernize doc

2020-07-24 Thread Paul Eggert
* doc/parse-datetime.texi: Use more-current examples. Don’t lead with 32-bit time_t, as it’s on its way out. Capitalize “Epoch” to be consistent with POSIX. --- ChangeLog | 5 +++ doc/parse-datetime.texi | 97 - 2 files changed, 53 insertions(

[PATCH] timespec: remove dependence on ‘verify’

2020-07-24 Thread Paul Eggert
* lib/timespec.h: Do not include verify.h; no longer needed. * modules/timespec (Depends-on): Remove ‘verify’. --- ChangeLog| 4 lib/timespec.h | 1 - modules/timespec | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b922dca63..1f46cc

[PATCH 2/2] Optimize a few more three-valued comparisons

2020-07-24 Thread Paul Eggert
* lib/timespec.h (timespec_cmp, timespec_sign): * lib/utimecmp.c (utimecmpat): Avoid conditional branches by using _GL_CMP. --- ChangeLog | 5 + lib/timespec.h | 40 +++- lib/utimecmp.c | 6 ++ 3 files changed, 10 insertions(+), 41 deletions(-) d

[PATCH 1/2] Fix _GL_CMP parenthesization typo

2020-07-24 Thread Paul Eggert
* m4/gnulib-common.m4 (_GL_CMP): Properly parenthesize. --- ChangeLog | 5 + m4/gnulib-common.m4 | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 23e809982..01577c9bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-07-24

Re: dfa.c change - please revert

2020-07-24 Thread arnold
Thanks. A few times a week I 'git pull' to see if anything has changed that affects gawk. Arnold Bruno Haible wrote: > Hi Arnold, > > > Please revert this, as it breaks compilation in gawk. > > This patch should do it (keeping the optimized variant of the 3-way > comparison). > > Btw, how did

Re: dfa.c change - please revert

2020-07-24 Thread Bruno Haible
Hi Arnold, > Please revert this, as it breaks compilation in gawk. This patch should do it (keeping the optimized variant of the 3-way comparison). Btw, how did you notice the breakage so rapidly? Are you scanning the commits or the mails, or do you have a continuous integration? 2020-07-24 B

dfa.c change - please revert

2020-07-24 Thread Arnold Robbins
Hi. | diff --git a/lib/dfa.c b/lib/dfa.c | index dee7be861..1d2d40457 100644 | --- a/lib/dfa.c | +++ b/lib/dfa.c | @@ -2466,7 +2466,7 @@ static int | compare (const void *a, const void *b) | { |position const *p = a, *q = b; | - return p->index < q->index ? -1 : p->index > q->index; | + re

Re: Module with preprocessor utilities

2020-07-24 Thread Marc Nieper-Wißkirchen
Am Fr., 24. Juli 2020 um 10:56 Uhr schrieb Florian Weimer : > This is the case that is unclear: > > double x[2]; > double *p = &x[1]; > > The standard explicitly says “first element of an array”. That's fine as well, I think. "x + 1" just points to an array of length 1 in memory.

Re: Module with preprocessor utilities

2020-07-24 Thread Florian Weimer
* Marc Nieper-Wißkirchen: > Am Fr., 24. Juli 2020 um 10:05 Uhr schrieb Florian Weimer > : > >> It's still a candidate for an RFE. Martin Sebor has been working on >> such warnings. I'm going to talk to him. > > It may also be useful for optimizations because the compiler may make > assumptions.

Re: Module with preprocessor utilities

2020-07-24 Thread Marc Nieper-Wißkirchen
Am Fr., 24. Juli 2020 um 10:05 Uhr schrieb Florian Weimer : > It's still a candidate for an RFE. Martin Sebor has been working on > such warnings. I'm going to talk to him. It may also be useful for optimizations because the compiler may make assumptions. > >> It's also undefined when you pass

Re: Module with preprocessor utilities

2020-07-24 Thread Florian Weimer
* Marc Nieper-Wißkirchen: > Am Fr., 24. Juli 2020 um 08:53 Uhr schrieb Florian Weimer > : > >> * Bruno Haible: > >> > (This is with gcc 10.1.0.) >> > >> > clang, OTOH, produces warnings for both foo1 and foo2. >> > >> > But I won't spend time to report a GCC bug on this, because - as you said - >

Re: Module with preprocessor utilities

2020-07-24 Thread Marc Nieper-Wißkirchen
Am Fr., 24. Juli 2020 um 08:53 Uhr schrieb Florian Weimer : > * Bruno Haible: > > (This is with gcc 10.1.0.) > > > > clang, OTOH, produces warnings for both foo1 and foo2. > > > > But I won't spend time to report a GCC bug on this, because - as you said - > > without the ability to declare a poin