Hi friends,
> Le 22 déc. 2019 à 21:48, Paul Eggert a écrit :
>
> On 12/22/19 3:31 AM, Bruno Haible wrote:
>
>> diff --git a/lib/xtime.h b/lib/xtime.h
>> index 77f1c30..5e0ae89 100644
>> --- a/lib/xtime.h
>> +++ b/lib/xtime.h
>> @@ -42,12 +42,13 @@ extern "C" {
>> XTIME_INLINE xtime_t
>> xtime_m
On 12/24/19 1:34 AM, Bruno Haible wrote:
>> - (corr_quad + (corr_quad < 0)) / 25 - (corr_quad < 0)
> Shouldn't that be parenthesized differently?
>
>- ((corr_quad + (corr_quad < 0)) / 25 - (corr_quad < 0))
Right you are. Thanks, I fixed that. I very much doubt whether
Paul Eggert wrote:
> the remaining patches are for other instances of this idiom in Gnulib.
These other instances use 'int', not 'long long'. The machine code is similar:
===
int sec1 (int t)
{ return (t < 0 ? (t + 1) / 1
On 12/23/19 12:38 AM, Bruno Haible wrote:
> => I'm in favour of installing your new formula.
Sure, I installed the attached. The first patch is for xtime.h, the remaining
patches are for other instances of this idiom in Gnulib.
>From 6ad341ee4a0cca1a8b1744bc269282aafd765868 Mon Sep 17 00:00:00 200
Hi Paul,
Now you got me hooked :)
> the following
> code should be faster than the other options mentioned, as it should avoid
> both
> conditional branches and compilers' overoptimizations.
>
> return (t + (t < 0)) / 10 - (t < 0);
The assembly code indeed shows no conditional jump a
Right you are; I should have measured. Though if speed's the deal, the following
code should be faster than the other options mentioned, as it should avoid both
conditional branches and compilers' overoptimizations.
return (t + (t < 0)) / 10 - (t < 0);
Hi Paul,
> > xtime_sec (xtime_t t)
> > {
> >return (t < 0
> > - ? (t + XTIME_PRECISION - 1) / XTIME_PRECISION - 1
> > + ? (t + 1) / XTIME_PRECISION - 1
> >: xtime_nonnegative_sec (t));
>
> Thanks for pointing out the bug. We can simplify the fix further (and sp
Hi Paul,
> > diff --git a/lib/xtime.h b/lib/xtime.h
> > index 77f1c30..5e0ae89 100644
> > --- a/lib/xtime.h
> > +++ b/lib/xtime.h
> > @@ -42,12 +42,13 @@ extern "C" {
> > XTIME_INLINE xtime_t
> > xtime_make (xtime_t s, long int ns)
> > {
> > - const long int giga = 1000 * 1000 * 1000;
> > - s
On 12/22/19 3:31 AM, Bruno Haible wrote:
> diff --git a/lib/xtime.h b/lib/xtime.h
> index 77f1c30..5e0ae89 100644
> --- a/lib/xtime.h
> +++ b/lib/xtime.h
> @@ -42,12 +42,13 @@ extern "C" {
> XTIME_INLINE xtime_t
> xtime_make (xtime_t s, long int ns)
> {
> - const long int giga = 1000 * 1000 *
Hi Paul,
This formula in xtime.h caught my attention:
xtime_sec (xtime_t t)
{
return (t < 0
? (t + XTIME_PRECISION - 1) / XTIME_PRECISION - 1
: xtime_nonnegative_sec (t));
}
Let's look at its behaviour for t < 0.
It looks wrong for two reasons:
1) This function is suppos
10 matches
Mail list logo