Skip to content

Commit 6d95e4b

Browse files
committed
update
1 parent 43e876b commit 6d95e4b

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

cp-algo/math/bigint.hpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -159,23 +159,17 @@ namespace cp_algo::math {
159159
char buf[20];
160160
auto [ptr, ec] = std::to_chars(buf, buf + sizeof(buf), x.digits.back(), sub_base);
161161
if constexpr (base == x16) {
162-
for (char* p = buf; p != ptr; ++p) {
163-
*p = (char)std::toupper(*p);
164-
}
162+
std::ranges::transform(buf, buf, toupper);
165163
}
166-
buf[ptr - buf] = 0;
167-
out << buf;
164+
out << std::string_view(buf, ptr - buf);
168165
for (auto d: x.digits | std::views::reverse | std::views::drop(1)) {
169166
auto [ptr, ec] = std::to_chars(buf, buf + sizeof(buf), d, sub_base);
170167
if constexpr (base == x16) {
171-
for (char* p = buf; p != ptr; ++p) {
172-
*p = (char)std::toupper(*p);
173-
}
168+
std::ranges::transform(buf, buf, toupper);
174169
}
175170
auto len = ptr - buf;
176171
out << std::string(digit_length - len, '0');
177-
buf[len] = 0;
178-
out << buf;
172+
out << std::string_view(buf, len);
179173
}
180174
return out;
181175
}

0 commit comments

Comments
 (0)