Skip to content

Instantly share code, notes, and snippets.

@elazarl
elazarl / sprint_int.c
Last active May 9, 2023 08:20
Small standalone stupid function to convert integer value to string, for code with zero library support
#include <stdint.h>
#include <stdio.h>
char *sprint_int_(char *out, uint64_t a, uint64_t base) {
char itoc[] = "0123456789abcdef";
char *orig_out = out;
uint64_t a_ = a;
int i = 0;
while (a_ >= base) {
a_ /= base;
i++;