mirror of
https://github.com/KhronosGroup/SPIRV-Cross.git
synced 2024-11-09 22:00:05 +00:00
Fixed conflict with windows min and max
If windows.h is included before spirv_common.hpp without NOMINMAX being defined the windows min and max macros will conflict with the STL numeric limits functions.
This commit is contained in:
parent
b82536766d
commit
e07956776d
@ -220,7 +220,7 @@ static inline std::string convert_to_string(int32_t value)
|
||||
// INT_MIN is ... special on some backends. If we use a decimal literal, and negate it, we
|
||||
// could accidentally promote the literal to long first, then negate.
|
||||
// To workaround it, emit int(0x80000000) instead.
|
||||
if (value == std::numeric_limits<int32_t>::min())
|
||||
if (value == (std::numeric_limits<int32_t>::min)())
|
||||
return "int(0x80000000)";
|
||||
else
|
||||
return std::to_string(value);
|
||||
@ -231,7 +231,7 @@ static inline std::string convert_to_string(int64_t value, const std::string &in
|
||||
// INT64_MIN is ... special on some backends.
|
||||
// If we use a decimal literal, and negate it, we might overflow the representable numbers.
|
||||
// To workaround it, emit int(0x80000000) instead.
|
||||
if (value == std::numeric_limits<int64_t>::min())
|
||||
if (value == (std::numeric_limits<int64_t>::min)())
|
||||
return join(int64_type, "(0x8000000000000000u", (long_long_literal_suffix ? "ll" : "l"), ")");
|
||||
else
|
||||
return std::to_string(value) + (long_long_literal_suffix ? "ll" : "l");
|
||||
|
Loading…
Reference in New Issue
Block a user