Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
1010111
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
2 ms
·
1.
▲
by
1010111
10y ago
Thanks, i was not aware of that. What is a possible fix?
2.
▲
by
1010111
10y ago
It uses a bit mask from the leftmost bit to the rightmost and prints the respective bits in x. Is that more complicated than allocating memory on the heap, storing the bits, and then printing them in reverse? Also the code above does not co
3.
▲
by
1010111
10y ago
Shitty C code: the binary printing function is needlessly complicated. void print_bin(int x){ for(unsigned m=~(~0u>>1); m ; m>>=1) putchar(x&m?'1':'0'); putchar('\n'); }