#include "kttools.h" #include /* * VARS */ //Placeholder. /* * FUNCTIONS */ void i_to_str(uint64_t num, char* buf, int size, int radix) { //null terminate the string if(num == 0){ buf[0] = '0'; buf[1] = '\0'; return; } buf[--size] = '\0'; while(size > 0 && (num) != 0){ int isolated_num = num % radix; if(isolated_num > 9){ isolated_num+=7; } buf[--size] = '0' + isolated_num; num/=radix; } //now shift the whole thing to the left if(size != 0) { while(buf[size]!='\0') { *buf = buf[size]; buf++; } *buf = '\0'; } }