src/backend/utils/adt/numutils.c
int
pg_ultoa_n(uint32 value, char *a)
{
	int			olength,
				i = 0;

	/* Degenerate case */
	if (value == 0)
	{
		*a = '0';
		return 1;
	}

	olength = decimalLength32(value);

	/* Compute the result string. */
	while (value >= 10000)
	{
		const uint32 c = value - 10000 * (value / 10000);
		const uint32 c0 = (c % 100) << 1;
		const uint32 c1 = (c / 100) << 1;

		char	   *pos = a + olength - i;

		value /= 10000;

		memcpy(pos - 2, DIGIT_TABLE + c0, 2);
		memcpy(pos - 4, DIGIT_TABLE + c1, 2);
		i += 4;
	}
	if (value >= 100)
	{
		const uint32 c = (value % 100) << 1;

		char	   *pos = a + olength - i;

		value /= 100;

		memcpy(pos - 2, DIGIT_TABLE + c, 2);
		i += 2;
	}
	if (value >= 10)
	{
		const uint32 c = value << 1;

		char	   *pos = a + olength - i;

		memcpy(pos - 2, DIGIT_TABLE + c, 2);
	}
	else
	{
		*a = (char) ('0' + value);
	}

	return olength;
}
/*
 * pg_ultoa_n: converts an unsigned 32-bit integer to its string representation,
 * not NUL-terminated, and returns the length of that string representation
 *
 * Caller must ensure that 'a' points to enough memory to hold the result (at
 * least 10 bytes)
 */
converts an unsigned 32-bit integer to its string representation,
not NUL-terminated, and returns the length of that string representation

Caller must ensure that 'a' points to enough memory to hold the result (at
least 10 bytes)
converts an unsigned 32 - bit integer to its string representation not NUL - terminated and returns the length of that string representation Caller must ensure that ' a ' points to enough memory to hold the result ( at least 10 bytes )
int
pg_ultoa_n(uint32 value, char *a)
{
	int			olength,
				i = 0;
	if (value == 0)
	{
		*a = '0';
		return 1;
	}
	olength = decimalLength32(value);
	while (value >= 10000)
	{
		const uint32 c = value - 10000 * (value / 10000);
		const uint32 c0 = (c % 100) << 1;
		const uint32 c1 = (c / 100) << 1;
		char	   *pos = a + olength - i;
		value /= 10000;
		memcpy(pos - 2, DIGIT_TABLE + c0, 2);
		memcpy(pos - 4, DIGIT_TABLE + c1, 2);
		i += 4;
	}
	if (value >= 100)
	{
		const uint32 c = (value % 100) << 1;
		char	   *pos = a + olength - i;
		value /= 100;
		memcpy(pos - 2, DIGIT_TABLE + c, 2);
		i += 2;
	}
	if (value >= 10)
	{
		const uint32 c = value << 1;
		char	   *pos = a + olength - i;
		memcpy(pos - 2, DIGIT_TABLE + c, 2);
	}
	else
	{
		*a = (char) ('0' + value);
	}
	return olength;
}
int pg_ultoa_n ( uint32 value , char * a ) { int olength , i = 0 ; if ( value == 0 ) { * a = ' ' ; return 1 ; } olength = decimalLength32 ( value ) ; while ( value >= 10000 ) { const uint32 c = value - 10000 * ( value / 10000 ) ; const uint32 c0 = ( c % 100 ) << 1 ; const uint32 c1 = ( c / 100 ) << 1 ; char * pos = a + olength - i ; value /= 10000 ; memcpy ( pos - 2 , DIGIT_TABLE + c0 , 2 ) ; memcpy ( pos - 4 , DIGIT_TABLE + c1 , 2 ) ; i += 4 ; } if ( value >= 100 ) { const uint32 c = ( value % 100 ) << 1 ; char * pos = a + olength - i ; value /= 100 ; memcpy ( pos - 2 , DIGIT_TABLE + c , 2 ) ; i += 2 ; } if ( value >= 10 ) { const uint32 c = value << 1 ; char * pos = a + olength - i ; memcpy ( pos - 2 , DIGIT_TABLE + c , 2 ) ; } else { * a = ( char ) ( ' ' + value ) ; } return olength ; }
pg_ultoa_n: converts an unsigned 32-bit integer to its string representation,
 not NUL-terminated, and returns the length of that string representation
pg_ultoa_n : converts an unsigned 32 - bit integer to its string representation not NUL - terminated and returns the length of that string representation
/* Degenerate case */ /* Compute the result string. */