Update tlString.cc

This commit is contained in:
Pankaj Pandey 2017-12-06 18:32:17 +05:30 committed by GitHub
parent ff74c466d5
commit 58281695fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -231,6 +231,32 @@ tl::to_string (const unsigned long long &d)
return os.str ();
}
#if defined(HAVE_64BIT_COORD)
template <>
std::string
tl::to_string (const __int128 &d)
{
if (d < 0 ) {
return "-" + tl::to_string(static_cast<unsigned __int128>(-d));
} else {
return tl::to_string(static_cast<unsigned __int128>(d));
}
}
template <>
std::string
tl::to_string (const unsigned __int128 &d)
{
if (static_cast<uint64_t>(d) == d) {
return tl::to_string(static_cast<uint64_t>(d));
}
std::ostringstream os;
os.imbue (c_locale);
os << "0x" << std::hex << static_cast<uint64_t> (d>>64) << static_cast<uint64_t> (d);
return os.str ();
}
#endif
template <>
std::string
tl::to_string (char * const &cp)