Skip to content

Commit a82e06f

Browse files
committed
added _bin in debug.
1 parent 0a5cccb commit a82e06f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/alfred/debug

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ using std::string;
1818

1919
const long long dbg_inf = 9e18 + 19260817;
2020

21+
std::string _bin(long long v) {
22+
assert(v >= 0);
23+
std::string res;
24+
if (v == 0) return "0";
25+
while (v > 0) {
26+
res += char((v & 1) | 48);
27+
v >>= 1;
28+
}
29+
std::reverse(res.begin(), res.end());
30+
return res;
31+
}
32+
2133
void __print(int x) { cerr << x; }
2234
void __print(long x) { cerr << x; }
2335
void __print(long long x) {

0 commit comments

Comments
 (0)