Use intermOut.cpp's IsNan and IsInfinity for parse-time constant folding (updated)
authorMarius Hillenbrand <mhillen@linux.ibm.com>
Tue, 9 Nov 2021 15:31:22 +0000 (16:31 +0100)
committerMarius Hillenbrand <mhillen@linux.ibm.com>
Thu, 11 Nov 2021 15:49:40 +0000 (16:49 +0100)
commit0eda343970e04e7c9447d264271b1c4cfdc923f4
tree20ab89c043507f6ce3d898102913f7a9a3177fb7
parent600c5037baac82a80851d1fb95f3f09d34bb43e8
Use intermOut.cpp's IsNan and IsInfinity for parse-time constant folding (updated)

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.

A previous commit with the same intent and purpose had missed a required
header for builds on Windows.

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