Changes imported from Abseil "staging" branch:
- c910f1792eae8cfdabb93bc261bf26e72f9a6717 Fix uint128 streaming to work with std::ios::internal. by Alex Strelnikov <strel@google.com> GitOrigin-RevId: c910f1792eae8cfdabb93bc261bf26e72f9a6717 Change-Id: I8ccce2ce6ac91ef7ce16fa8870a718fdfb8fa9a6
This commit is contained in:
parent
b05b79538f
commit
4f3edeb1b4
2 changed files with 26 additions and 2 deletions
|
@ -187,8 +187,14 @@ std::ostream& operator<<(std::ostream& o, const uint128& b) {
|
|||
// Add the requisite padding.
|
||||
std::streamsize width = o.width(0);
|
||||
if (static_cast<size_t>(width) > rep.size()) {
|
||||
if ((flags & std::ios::adjustfield) == std::ios::left) {
|
||||
std::ios::fmtflags adjustfield = flags & std::ios::adjustfield;
|
||||
if (adjustfield == std::ios::left) {
|
||||
rep.append(width - rep.size(), o.fill());
|
||||
} else if (adjustfield == std::ios::internal &&
|
||||
(flags & std::ios::showbase) &&
|
||||
(flags & std::ios::basefield) != std::ios::dec) {
|
||||
size_t base_size = (flags & std::ios::basefield) == std::ios::hex ? 2 : 1;
|
||||
rep.insert(base_size, width - rep.size(), o.fill());
|
||||
} else {
|
||||
rep.insert(0, width - rep.size(), o.fill());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue