Re: pgsql: Provide overflow safe integer math inline functions.

Christoph Berg <myon@debian.org>

From: Christoph Berg <myon@debian.org>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-committers@postgresql.org
Date: 2017-12-13T10:10:37Z
Lists: pgsql-hackers
Re: Andres Freund 2017-12-13 <E1eOvQF-00075r-Cy@gemulon.postgresql.org>
> Provide overflow safe integer math inline functions.

The new _overflow functions have buggy comments:

/*
 * If a - b overflows, return true, otherwise store the result of a + b into
 * *result.                                                         ^ there

Christoph


Commits

  1. Try harder to detect unavailability of __builtin_mul_overflow(int64).

  2. Try to detect runtime unavailability of __builtin_mul_overflow(int64).

  3. Fix a number of copy & paste comment errors in common/int.h.

  4. Provide overflow safe integer math inline functions.