Provide overflow safe integer math inline functions.

Andres Freund <andres@anarazel.de>

Commit: 4d6ad31257adaf8a51e1c4377d96afa656d9165f
Author: Andres Freund <andres@anarazel.de>
Date: 2017-12-13T00:55:37Z
Releases: 11.0
Provide overflow safe integer math inline functions.

It's not easy to get signed integer overflow checks correct and
fast. Therefore abstract the necessary infrastructure into a common
header providing addition, subtraction and multiplication for 16, 32,
64 bit signed integers.

The new macros aren't yet used, but a followup commit will convert
several open coded overflow checks.

Author: Andres Freund, with some code stolen from Greg Stark
Reviewed-By: Robert Haas
Discussion: https://postgr.es/m/20171024103954.ztmatprlglz3rwke@alap3.anarazel.de

Files

PathChange+/−
config/c-compiler.m4 modified +22 −0
configure modified +33 −0
configure.in modified +4 −0
src/include/common/int.h added +239 −0
src/include/pg_config.h.in modified +3 −0
src/include/pg_config.h.win32 modified +3 −0

Discussion