Use intermOut.cpp's IsNan and IsInfinity for parse-time constant folding
authorMarius Hillenbrand <mhillen@linux.ibm.com>
Tue, 9 Nov 2021 15:31:22 +0000 (16:31 +0100)
committerMarius Hillenbrand <mhillen@linux.ibm.com>
Tue, 9 Nov 2021 15:58:21 +0000 (16:58 +0100)
commitd1ee644e1d8f25c6dba8c00e4839b2c0380e9949
tree61b79ce1de2a8de74745042093c60b018acb4c88
parent8f56d738000ba2b39595160b2d345821ce03d18f
Use intermOut.cpp's IsNan and IsInfinity for parse-time constant folding

There were two implementations of isInf() and isNan(), in Constant.cpp
and in intermOut.cpp. The former only works on little-endian systems,
the latter is a wrapper for library functions and works regardless of
endianness. Move the second version into Common.h and adopt it in both
places. Thereby avoid the duplication and fix for big-endian systems.

On s390x, this fixes the test case
Glsl/CompileToAstTest.FromFile/constFold_frag.

Fixes #2802
glslang/Include/Common.h
glslang/MachineIndependent/Constant.cpp
glslang/MachineIndependent/intermOut.cpp