Changeset - r7316:32b8e520559e
[Not reviewed]
master
0 1 0
truelight - 17 years ago 2007-07-24 12:29:47
truelight@openttd.org
(svn r10671) -Codechange: don't mix both lookup and temp-variable-with-value-of-lookup (skidd13)
1 file changed with 4 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/strings.cpp
Show inline comments
 
@@ -238,13 +238,13 @@ static const uint32 _divisor_table[] = {
 
	1
 
};
 

	
 
// TODO
 
static char *FormatCommaNumber(char *buff, int32 number, const char* last)
 
{
 
	uint32 quot,divisor;
 
	uint32 quot;
 
	int i;
 
	uint32 tot;
 
	uint32 num;
 

	
 
	if (number < 0) {
 
		*buff++ = '-';
 
@@ -252,15 +252,14 @@ static char *FormatCommaNumber(char *buf
 
	}
 

	
 
	num = number;
 

	
 
	tot = 0;
 
	for (i = 0; i != 10; i++) {
 
		divisor = _divisor_table[i];
 
		quot = 0;
 
		if (num >= divisor) {
 
		if (num >= _divisor_table[i]) {
 
			quot = num / _divisor_table[i];
 
			num = num % _divisor_table[i];
 
		}
 
		if (tot |= quot || i == 9) {
 
			*buff++ = '0' + quot;
 
			if (i == 0 || i == 3 || i == 6) *buff++ = ',';
 
@@ -272,13 +271,13 @@ static char *FormatCommaNumber(char *buf
 
	return buff;
 
}
 

	
 
// TODO
 
static char *FormatNoCommaNumber(char *buff, int32 number, const char* last)
 
{
 
	uint32 quot,divisor;
 
	uint32 quot;
 
	int i;
 
	uint32 tot;
 
	uint32 num;
 

	
 
	if (number < 0) {
 
		buff = strecpy(buff, "-", last);
 
@@ -286,15 +285,14 @@ static char *FormatNoCommaNumber(char *b
 
	}
 

	
 
	num = number;
 

	
 
	tot = 0;
 
	for (i = 0; i != 10; i++) {
 
		divisor = _divisor_table[i];
 
		quot = 0;
 
		if (num >= divisor) {
 
		if (num >= _divisor_table[i]) {
 
			quot = num / _divisor_table[i];
 
			num = num % _divisor_table[i];
 
		}
 
		if (tot |= quot || i == 9) {
 
			*buff++ = '0' + quot;
 
		}
0 comments (0 inline, 0 general)