Handle 0 case. - int2bit - Convert integer to funny way. HTML git clone git://bitreich.org/int2bit git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/int2bit DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit d2039baff0597cd972de720326eae523d3515df7 DIR parent 9987cd151f8ed60a51102d217cee5462e587e692 HTML Author: Christoph Lohmann <20h@r-36.net> Date: Thu, 13 May 2021 22:42:16 +0200 Handle 0 case. Diffstat: M int2bit.c | 5 +++++ 1 file changed, 5 insertions(+), 0 deletions(-) --- DIR diff --git a/int2bit.c b/int2bit.c @@ -24,6 +24,11 @@ main(int argc, char *argv[]) in = atoi(argv[1]); srand(in); + if (in == 0) { + printf("0x0\n"); + return 0; + } + for (hasprint = 0, hexprint = 0, i = (sizeof(in) * 8)-1; i >= 0; i--) { if (in & (1<<i)) { /* Decide about next step. */