Re: Remove dependence on integer wrapping - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Remove dependence on integer wrapping
Date
Msg-id Zr5M3KxOZlEZRZIN@nathan
Whole thread Raw
In response to Re: Remove dependence on integer wrapping  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On Thu, Aug 15, 2024 at 02:56:00PM +0800, jian he wrote:
> i am confused with
> "
> +#elif defined(HAVE_INT128)
> + uint128 res = -((int128) a);
> "
> I thought "unsigned" means non-negative, therefore uint128 means non-negative.
> therefore "int128  res = -((int128) a);" makes sense to me.

Ah, that's a typo, thanks for pointing it out.

> also in HAVE_INT128 branch
> do we need cast int128 to int64, like
> 
> *result = (int64) res;

I don't think we need an explicit cast here since *result is known to be an
int64.  But it certainly wouldn't hurt anything...

-- 
nathan



pgsql-hackers by date:

Previous
From: Rafia Sabih
Date:
Subject: Re: Reducing the log spam
Next
From: Bruce Momjian
Date:
Subject: Re: Partial aggregates pushdown