From c9cbeced5b3f2bdd7407e29c0811e65954132540 Mon Sep 17 00:00:00 2001 From: Root THC Date: Tue, 24 Feb 2026 12:42:47 +0000 Subject: initial --- other/Kermit/lib/itos16.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 other/Kermit/lib/itos16.cpp (limited to 'other/Kermit/lib/itos16.cpp') diff --git a/other/Kermit/lib/itos16.cpp b/other/Kermit/lib/itos16.cpp new file mode 100644 index 0000000..b7a8a20 --- /dev/null +++ b/other/Kermit/lib/itos16.cpp @@ -0,0 +1,36 @@ +/* + * itos16.cpp: + * written by palmers / teso + */ +#include +#include + + string itos16 (unsigned int x) + { + char t[] = "0123456789abcdef"; + string y; + unsigned int a, + base = 1, + z = 0; + + while (base < x && z++ < 7) + base *= 16; + + if (z != 8 && z != 0) + base /= 16; + + while (base != 1) + { + a = 0; + while (x >= base) + { + a++; + x -= base; + } + y += t[a]; + base /= 16; + } + y += t[x]; + return y; + } + -- cgit v1.3