Re: Current int & float overflow checking is slow.

Greg Stark <stark@mit.edu>

From: Greg Stark <stark@mit.edu>
To: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2017-10-24T12:26:32Z
Lists: pgsql-hackers
We already know this integer overflow checking is non-standard and
compilers keep trying to optimize them out.  Our only strategy to
defeat that depends on compiler flags like -fwrapv that vary by
compiler and may or may not be working on less well tested compiler.

So if there's a nice readable and convenient way to portably use cpu
flags That would be brilliant. And I'm not too concerned if it doesn't
run on VAX.


Commits

  1. Provide overflow safe integer math inline functions.

  2. Use new overflow aware integer operations.