We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f6a8373 commit 2694be8Copy full SHA for 2694be8
1 file changed
src/alfred/config/fast-io.hpp
@@ -94,15 +94,17 @@ inline void fast_read(std::string &s) {
94
95
template <class T>
96
inline void write(T x) {
97
- int cnt = 0;
98
- static char buf[40];
+ bool neg = false;
99
if (x < 0) {
100
- buf[cnt++] = '-', x = -x;
+ neg = true, x = -x;
101
}
+ int it = 40;
102
+ static char buf[40];
103
do {
- buf[cnt++] = (x % 10) ^ 48, x /= 10;
104
+ buf[--it] = (x % 10) ^ 48, x /= 10;
105
} while (x);
- while (cnt--) __buf.pc(buf[cnt]);
106
+ if (neg) buf[--it] = '-';
107
+ __buf.ps(buf + it, 40 - it);
108
109
template <int mod>
110
inline void write(ModInt<mod> x) { write(x.x); }
0 commit comments