src/melon/modules/string/format.c
static size_t _ntoa_long(out_fct_type out, char *buffer, size_t idx, size_t maxlen, unsigned long value, bool negative, unsigned long base, unsigned int prec, unsigned int width, unsigned int flags)
{
	char buf[PRINTF_NTOA_BUFFER_SIZE];
	size_t len = 0U;

	// no hash for 0 values
	if (!value)
	{
		flags &= ~FLAGS_HASH;
	}

	// write if precision != 0 and value is != 0
	if (!(flags & FLAGS_PRECISION) || value)
	{
		do
		{
			const char digit = (char)(value % base);
			buf[len++] = digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10;
			value /= base;
		} while (value && (len < PRINTF_NTOA_BUFFER_SIZE));
	}

	return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec, width, flags);
}
// internal itoa for 'long' type

internal itoa for 'long' type
internal itoa for ' long ' type
static size_t _ntoa_long(out_fct_type out, char *buffer, size_t idx, size_t maxlen, unsigned long value, bool negative, unsigned long base, unsigned int prec, unsigned int width, unsigned int flags)
{
	char buf[PRINTF_NTOA_BUFFER_SIZE];
	size_t len = 0U;
	if (!value)
	{
		flags &= ~FLAGS_HASH;
	}
	if (!(flags & FLAGS_PRECISION) || value)
	{
		do
		{
			const char digit = (char)(value % base);
			buf[len++] = digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10;
			value /= base;
		} while (value && (len < PRINTF_NTOA_BUFFER_SIZE));
	}
	return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec, width, flags);
}
static size_t _ntoa_long ( out_fct_type out , char * buffer , size_t idx , size_t maxlen , unsigned long value , bool negative , unsigned long base , unsigned int prec , unsigned int width , unsigned int flags ) { char buf [ PRINTF_NTOA_BUFFER_SIZE ] ; size_t len = 0U ; if ( ! value ) { flags &= ~ FLAGS_HASH ; } if ( ! ( flags & FLAGS_PRECISION ) || value ) { do { const char digit = ( char ) ( value % base ) ; buf [ len ++ ] = digit < 10 ? ' ' + digit : ( flags & FLAGS_UPPERCASE ? ' ' : ' ' ) + digit - 10 ; value /= base ; } while ( value && ( len < PRINTF_NTOA_BUFFER_SIZE ) ) ; } return _ntoa_format ( out , buffer , idx , maxlen , buf , len , negative , ( unsigned int ) base , prec , width , flags ) ; }
internal itoa for 'long' type
internal itoa for ' long ' type
// no hash for 0 values
 // write if precision != 0 and value is != 0
