Unverified Commit 08b1a8a4 authored by Milo Yip's avatar Milo Yip Committed by GitHub

Merge pull request #1302 from chwarr/min-max-guard

Guard against min/max being macros in reader.h
parents 81af404b 960b9cfd
...@@ -79,12 +79,12 @@ static void Verify(void(*f)(T, char*), char* (*g)(T, char*)) { ...@@ -79,12 +79,12 @@ static void Verify(void(*f)(T, char*), char* (*g)(T, char*)) {
do { do {
VerifyValue<T>(i - 1, f, g); VerifyValue<T>(i - 1, f, g);
VerifyValue<T>(i, f, g); VerifyValue<T>(i, f, g);
if (std::numeric_limits<T>::min() < 0) { if ((std::numeric_limits<T>::min)() < 0) {
VerifyValue<T>(Traits<T>::Negate(i), f, g); VerifyValue<T>(Traits<T>::Negate(i), f, g);
VerifyValue<T>(Traits<T>::Negate(i + 1), f, g); VerifyValue<T>(Traits<T>::Negate(i + 1), f, g);
} }
last = i; last = i;
if (i > static_cast<T>(std::numeric_limits<T>::max() / static_cast<T>(power))) if (i > static_cast<T>((std::numeric_limits<T>::max)() / static_cast<T>(power)))
break; break;
i *= static_cast<T>(power); i *= static_cast<T>(power);
} while (last < i); } while (last < i);
......
...@@ -422,7 +422,7 @@ static void TestParseDouble() { ...@@ -422,7 +422,7 @@ static void TestParseDouble() {
"67546703537516986049910576551282076245490090389328944075868508455133942" "67546703537516986049910576551282076245490090389328944075868508455133942"
"30458323690322294816580855933212334827479782620414472316873817718091929" "30458323690322294816580855933212334827479782620414472316873817718091929"
"9881250404026184124858368", "9881250404026184124858368",
std::numeric_limits<double>::max()); (std::numeric_limits<double>::max)());
TEST_DOUBLE(fullPrecision, TEST_DOUBLE(fullPrecision,
"243546080556034731077856379609316893158278902575447060151047" "243546080556034731077856379609316893158278902575447060151047"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment