Work around cray++ compiler issue
It's still not clear as to what exactly makes it emit this error when compiling string_to_integer: CC-3059 crayc++: INTERNAL __C_FILE_SCOPE_DATA__, File = <pugixml>/src/pugixml.cpp, Line = 4524, Column = 4 Expected no overflow in routine. But a viable workaround for now is to exploit the knowledge that it uses two-complement arithmetics and invert the sign manually. Fixes #125.
This commit is contained in:
parent
e3524c90de
commit
05edb250ee
@ -4521,7 +4521,14 @@ PUGI__NS_BEGIN
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (negative)
|
if (negative)
|
||||||
|
{
|
||||||
|
// Workaround for crayc++ CC-3059: Expected no overflow in routine.
|
||||||
|
#ifdef _CRAYC
|
||||||
|
return (overflow || result > minneg) ? ~minneg + 1 : ~result + 1;
|
||||||
|
#else
|
||||||
return (overflow || result > minneg) ? 0 - minneg : 0 - result;
|
return (overflow || result > minneg) ? 0 - minneg : 0 - result;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return (overflow || result > maxpos) ? maxpos : result;
|
return (overflow || result > maxpos) ? maxpos : result;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user