Fix print_int.
GitOrigin-RevId: caff5ca11c300aef7658a029028d252253c4176c
This commit is contained in:
parent
2afbf38c33
commit
21969e4d02
@ -81,11 +81,10 @@ template <class T>
|
|||||||
static char *print_int(char *current_ptr, T x) {
|
static char *print_int(char *current_ptr, T x) {
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
if (x == std::numeric_limits<T>::min()) {
|
if (x == std::numeric_limits<T>::min()) {
|
||||||
std::stringstream ss;
|
current_ptr = print_int(current_ptr, x + 1);
|
||||||
ss << x;
|
CHECK(current_ptr[-1] != '9');
|
||||||
auto len = narrow_cast<int>(static_cast<std::streamoff>(ss.tellp()));
|
current_ptr[-1]++;
|
||||||
ss.read(current_ptr, len);
|
return current_ptr;
|
||||||
return current_ptr + len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*current_ptr++ = '-';
|
*current_ptr++ = '-';
|
||||||
|
Loading…
Reference in New Issue
Block a user